\hypertarget{class_game_engine}{
\section{GameEngine Class Reference}
\label{class_game_engine}\index{GameEngine@{GameEngine}}
}


The {\ttfamily \hyperlink{class_game_engine}{GameEngine}} class contains the main game loop and all the necessary methods to keep up the actual gameplay.  


\subsection*{Signals}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_game_engine_ad67c460e1c11d3f5a6cfc49f8ec6baf5}{
void \hyperlink{class_game_engine_ad67c460e1c11d3f5a6cfc49f8ec6baf5}{changeBackGroundImage} (int level)}
\label{class_game_engine_ad67c460e1c11d3f5a6cfc49f8ec6baf5}

\begin{DoxyCompactList}\small\item\em Signal emitted when background image change is needed. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a7216f36f2a9abb7e5b77e8247b544b05}{
void \hyperlink{class_game_engine_a7216f36f2a9abb7e5b77e8247b544b05}{gameOver} (int score, FPtype time)}
\label{class_game_engine_a7216f36f2a9abb7e5b77e8247b544b05}

\begin{DoxyCompactList}\small\item\em Signal emitted when ''Game Over'' game state is needed (no more miners left). \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_ab28e071dad27a8b6c35dc208edb4820a}{
void \hyperlink{class_game_engine_ab28e071dad27a8b6c35dc208edb4820a}{playerCrashed} ()}
\label{class_game_engine_ab28e071dad27a8b6c35dc208edb4820a}

\begin{DoxyCompactList}\small\item\em Signal emitted when player crashed to start the rewind mode playback. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{class_game_engine_aef6f9a129c1605dece77279e87d177fb}{GameEngine} (bool, int)
\begin{DoxyCompactList}\small\item\em Constructor of {\ttfamily \hyperlink{class_game_engine}{GameEngine}} class. \item\end{DoxyCompactList}\item 
\hyperlink{class_game_engine_a8e59d8341ef9d2dcc62eee1437e37f14}{$\sim$GameEngine} ()
\begin{DoxyCompactList}\small\item\em Destructor of {\ttfamily \hyperlink{class_game_engine}{GameEngine}} class. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_game_engine_a50385f9d1e5945baaa677ddc4ee914be}{
static int \hyperlink{class_game_engine_a50385f9d1e5945baaa677ddc4ee914be}{getRandomI} ()}
\label{class_game_engine_a50385f9d1e5945baaa677ddc4ee914be}

\begin{DoxyCompactList}\small\item\em Returns a pseudo-\/random integer from range 0 to RAND\_\-MAX. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_adbe921920470bcd340c0c9c563b167ff}{
static FPtype \hyperlink{class_game_engine_adbe921920470bcd340c0c9c563b167ff}{getRandomF} ()}
\label{class_game_engine_adbe921920470bcd340c0c9c563b167ff}

\begin{DoxyCompactList}\small\item\em Returns a pseudo-\/random value as FPtype from range $ 0.0 \dots 1.0 $. \item\end{DoxyCompactList}\item 
static void \hyperlink{class_game_engine_a3f48272ecfd570f8ca590873c5a9cb01}{normalizeVect3D\_\-GLfloat} (GLfloat $\ast$vect)
\begin{DoxyCompactList}\small\item\em Normalized a give 3-\/component vector. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Static Public Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_game_engine_a962f8e20ee87669b8f9a367deef0d002}{
static const FPtype \hyperlink{class_game_engine_a962f8e20ee87669b8f9a367deef0d002}{BlackHoleEffectDistance} = 220.0f}
\label{class_game_engine_a962f8e20ee87669b8f9a367deef0d002}

\begin{DoxyCompactList}\small\item\em Black hole effect distance, append black hole gravity effect. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_ae10f0c78a5cd136c6d43d7e6ad35b31a}{
static const FPtype \hyperlink{class_game_engine_ae10f0c78a5cd136c6d43d7e6ad35b31a}{BlackHoleForce} = 0.2f}
\label{class_game_engine_ae10f0c78a5cd136c6d43d7e6ad35b31a}

\begin{DoxyCompactList}\small\item\em Black hole force factor used when calculating black hole gravity effect impact on game object. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_ada044c300dc4ad2689cff8fe42a5bdde}{
static const FPtype \hyperlink{class_game_engine_ada044c300dc4ad2689cff8fe42a5bdde}{GameObjectRadiusAsteroidL} = 9.0f}
\label{class_game_engine_ada044c300dc4ad2689cff8fe42a5bdde}

\begin{DoxyCompactList}\small\item\em Large asteroid radius. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_af238cf75a21afe009fb708f605821b71}{
static const FPtype \hyperlink{class_game_engine_af238cf75a21afe009fb708f605821b71}{GameObjectRadiusAsteroidM} = 6.5f}
\label{class_game_engine_af238cf75a21afe009fb708f605821b71}

\begin{DoxyCompactList}\small\item\em Medium sized asteroid radius. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_add6f535c178b363070206851404bf43a}{
static const FPtype \hyperlink{class_game_engine_add6f535c178b363070206851404bf43a}{GameObjectRadiusSpaceCraft} = 8.0f}
\label{class_game_engine_add6f535c178b363070206851404bf43a}

\begin{DoxyCompactList}\small\item\em Space ship AKA space craft AKA miner radius. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_af3f7575d8267137878e7b68ecec8b8b1}{
static const FPtype \hyperlink{class_game_engine_af3f7575d8267137878e7b68ecec8b8b1}{GameObjectRadiusMineral} = 5.0f}
\label{class_game_engine_af3f7575d8267137878e7b68ecec8b8b1}

\begin{DoxyCompactList}\small\item\em \hyperlink{class_mineral}{Mineral} collectible radius. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a78c03401eac335174c6027d30df8685b}{
static const FPtype \hyperlink{class_game_engine_a78c03401eac335174c6027d30df8685b}{GameObjectRadiusUFO} = 8.0f}
\label{class_game_engine_a78c03401eac335174c6027d30df8685b}

\begin{DoxyCompactList}\small\item\em UFO radius. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a085a9d75e95b22c4ba995cc6af46e12f}{
static const FPtype \hyperlink{class_game_engine_a085a9d75e95b22c4ba995cc6af46e12f}{GameObjectRadiusBomb} = 8.0f}
\label{class_game_engine_a085a9d75e95b22c4ba995cc6af46e12f}

\begin{DoxyCompactList}\small\item\em \hyperlink{class_bomb}{Bomb} collectible radius. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a0ac270984497b2c7420d48d06eb350f1}{
static const FPtype \hyperlink{class_game_engine_a0ac270984497b2c7420d48d06eb350f1}{GameObjectRadiusHyperJump} = 8.0f}
\label{class_game_engine_a0ac270984497b2c7420d48d06eb350f1}

\begin{DoxyCompactList}\small\item\em Hyper jump collectible radius. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a5148cf44e0c55e9acc4c3b0e5de3e58f}{
static const FPtype \hyperlink{class_game_engine_a5148cf44e0c55e9acc4c3b0e5de3e58f}{GameObjectRadiusMissile} = 6.0f}
\label{class_game_engine_a5148cf44e0c55e9acc4c3b0e5de3e58f}

\begin{DoxyCompactList}\small\item\em \hyperlink{class_missile}{Missile} radius. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a1bd1182a3d9266dea388478030f31d27}{
static const FPtype \hyperlink{class_game_engine_a1bd1182a3d9266dea388478030f31d27}{GameObjectRadiusComet} = 15.0f}
\label{class_game_engine_a1bd1182a3d9266dea388478030f31d27}

\begin{DoxyCompactList}\small\item\em \hyperlink{class_comet}{Comet} radius. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Member Functions}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_game_engine_a613721fc2d9ca8391fa5c03cd6ce441c}{
FPtype \hyperlink{class_game_engine_a613721fc2d9ca8391fa5c03cd6ce441c}{steeringX} () const }
\label{class_game_engine_a613721fc2d9ca8391fa5c03cd6ce441c}

\begin{DoxyCompactList}\small\item\em Return the X-\/steering value of miner. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_ae85d32755398ae7caea950d88a249d7d}{
FPtype \hyperlink{class_game_engine_ae85d32755398ae7caea950d88a249d7d}{steeringY} () const }
\label{class_game_engine_ae85d32755398ae7caea950d88a249d7d}

\begin{DoxyCompactList}\small\item\em Return the Y-\/steering value of miner. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a8f01ae49252f09ef41aa02b5fd5bca76}{setSoundEngine} (\hyperlink{class_sound_engine}{SoundEngine} $\ast$engine)
\begin{DoxyCompactList}\small\item\em Sets the sound engine. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a7ba1fb61770758f4d551bfdc0243fc05}{setSteeringX} (FPtype steeringX)
\begin{DoxyCompactList}\small\item\em Sets the miner control X-\/coordinate steering value. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a60240c9dd57fa230a257d1d70c38dd45}{setSteeringY} (FPtype steeringY)
\begin{DoxyCompactList}\small\item\em Sets the miner control Y-\/coordinate steering value. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_afe8540c2b25afc331b3d92d8f9ec3842}{setShakeZ} (FPtype shakeZ)
\begin{DoxyCompactList}\small\item\em Sets the ''shake'' value according for hyper jump control. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_ae847fa42c15d4bba374f500015577c14}{
int \hyperlink{class_game_engine_ae847fa42c15d4bba374f500015577c14}{screenWidth} () const }
\label{class_game_engine_ae847fa42c15d4bba374f500015577c14}

\begin{DoxyCompactList}\small\item\em Returns the game screen width. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a0cb8cf573f40fe07a1ce197ffc363e76}{
int \hyperlink{class_game_engine_a0cb8cf573f40fe07a1ce197ffc363e76}{screenHeight} () const }
\label{class_game_engine_a0cb8cf573f40fe07a1ce197ffc363e76}

\begin{DoxyCompactList}\small\item\em Returns the game screen height. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a45c977471781cf798b62c8e8fd4aa200}{initNewGame} (bool \hyperlink{class_game_engine_a6552244f5c09e58c518c2e28418e039b}{rewindEnabled}, int difficultyLevel)
\begin{DoxyCompactList}\small\item\em Initializes a new game. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a0cb4c8cd0289b828d85588f68e728153}{cycleGameLoop} (FPtype timestep)
\begin{DoxyCompactList}\small\item\em The main game loop of the SmashMiner-\/game. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_ae936fa53b2e5a145864bebc0a9d6598e}{initializeFrame} (FPtype timestep)
\begin{DoxyCompactList}\small\item\em Initializes a new {\ttfamily \hyperlink{class_frame_info}{FrameInfo}} object for rewind mode. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a1b776db2514918c20a36018fc29497cc}{handleGameTimers} (FPtype timestep)
\begin{DoxyCompactList}\small\item\em Updates game timers and takes actions according to timer states. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a405e665741d74ca2062016bfcf940f68}{controlSpaceShip} (FPtype timestep)
\begin{DoxyCompactList}\small\item\em Sets the miner's velocity based on steering information. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_aae2169c42cd517e0989e8a03c9e36b3e}{advanceGameObjects} (FPtype timestep)
\begin{DoxyCompactList}\small\item\em Advances all the game objects according to given timestep. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a6e804b50ae2d2d7b4ce557b8323d0a47}{detectCollisions} ()
\begin{DoxyCompactList}\small\item\em Main entry point for collision detection between game objects. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a18954e6a69916acac6a548b10532d310}{controlGameEvents} (FPtype timestep)
\begin{DoxyCompactList}\small\item\em Handles misc game events which. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_ad1ec13623508f3c942d8730f0e8e58bd}{removeUnnecessaryObjects} ()
\begin{DoxyCompactList}\small\item\em Cleans up expired game objects. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a4082ada6ed021d5dbc87bac033d4a70b}{processNewEffects} ()
\begin{DoxyCompactList}\small\item\em Processes game effects stored in a list of new effects during the last game frame. \item\end{DoxyCompactList}\item 
bool \hyperlink{class_game_engine_a9bfe18fe519da69bbd7077d7d4efd817}{isUnnecessary} (\hyperlink{class_game_object}{GameObject} $\ast$gameObject)
\begin{DoxyCompactList}\small\item\em Checks if given object is expired: it's no longer ''alive'' and it's no longer needed for the rewind mode playback. \item\end{DoxyCompactList}\item 
bool \hyperlink{class_game_engine_aa4469b8ac4ade3f21c74e3f131aec4c2}{isOffScreen} (\hyperlink{class_game_object}{GameObject} $\ast$gameObject, FPtype $\ast$margins)
\begin{DoxyCompactList}\small\item\em Checks if the given game object's current location is off-\/screen. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a5b2cfc83c45aef838a19773539abe72e}{resetSpaceShip} (FPtype positionX, FPtype positionY)
\begin{DoxyCompactList}\small\item\em Resets the miner to given location. \item\end{DoxyCompactList}\item 
GLfloat \hyperlink{class_game_engine_a2c1e331c7ee2b68823ab08df15331d62}{shipModeStatus} () const 
\begin{DoxyCompactList}\small\item\em Returns the ship mode transformation status. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_ae8e27bd2226d8092117a2627dde79579}{changeShipModeDelayed} ()
\begin{DoxyCompactList}\small\item\em Change the ship mode delayed using timer. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_ad6aabc5c0d4417fa083d94f6847257de}{setShipModeImmediate} (\hyperlink{spacecraft_8h_a3cfdbc6a1f7160d294af1597cd5be2e2}{SpaceCraftMode} mode)
\begin{DoxyCompactList}\small\item\em Changes the ship mode instantly into give mode withoud animation delay. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_ab64d40c6c1e38769121602bf0936a371}{shipHyperJumpOut} ()
\begin{DoxyCompactList}\small\item\em Creates a hyper jump-\/out effect for the miner space ship. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a0d99b70c324e2ffa798a91fdc1e069d8}{shipHyperJumpIn} (bool needSpaceShipReset)
\begin{DoxyCompactList}\small\item\em Creates a hyper jump-\/in effect for miner space ship. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a9c68acd3f416ff54a494c2f85edfea26}{launchBomb} (FPtype positionX, FPtype positionY)
\begin{DoxyCompactList}\small\item\em Creates a bomb effect starting from given location. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a8cc6c528eed39526cc16b082f365f484}{launchBombSelf} (FPtype positionX, FPtype positionY)
\begin{DoxyCompactList}\small\item\em Creates a bomb self explosion effect. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a66036f5a81212b0cc98726f0df8ff270}{integrateMotion} (\hyperlink{class_game_object}{GameObject} $\ast$gameObject, FPtype timestep)
\begin{DoxyCompactList}\small\item\em Integrates movement to a game object according to given time step. \item\end{DoxyCompactList}\item 
bool \hyperlink{class_game_engine_a5aea019c22835941c258710378f829d0}{detect} (const \hyperlink{class_game_object}{GameObject} $\ast$gameObjectA, const \hyperlink{class_game_object}{GameObject} $\ast$gameObjectB) const 
\begin{DoxyCompactList}\small\item\em Used for testing if collision has occured between game object A and B. \item\end{DoxyCompactList}\item 
bool \hyperlink{class_game_engine_aab271f38a27b694cc73fc0122d856989}{isPlayerProtected} ()
\begin{DoxyCompactList}\small\item\em Checks if the miner is in protected state. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a80076a8cc8c78b4401cc4c0f92fcd07e}{handleMinerAsteroidCollision} (int asteroidIndex)
\begin{DoxyCompactList}\small\item\em Handles a miner to asteroid collision. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a75fab1676bacd8c49529269e0acfec61}{handleAsteroidSplitting} (int asteroidIndex)
\begin{DoxyCompactList}\small\item\em Replaces a large asteroid with medium sized asteroids and a medium sized asteroid with mineral collectible. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a4a3c43561e4bf844c70e7d5889b45c95}{handleMinerCollectibleCollision} (int collectibleIndex)
\begin{DoxyCompactList}\small\item\em Handles a collision between the miner and a collectible. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_aa9111a6e3ccd429d86414c9aa3ccb6c3}{handlePlayerCrash} (const \hyperlink{soundengine_8h_a608db89860fa5723001cc530622ba5bf}{SoundEffectType} type)
\begin{DoxyCompactList}\small\item\em Handles a ''miner crashed''-\/event. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a057552def06970150d25252715261c4e}{handlePlayerDies} ()
\begin{DoxyCompactList}\small\item\em Handles a ''miner died''-\/event. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_aba7429045bf334f3c81b423a3279dc7d}{handleBumpCollision} (\hyperlink{class_game_object}{GameObject} $\ast$gameObjectA, \hyperlink{class_game_object}{GameObject} $\ast$gameObjectB) const 
\begin{DoxyCompactList}\small\item\em Creates a ''bump''-\/collision effect between two colliding game objects A and B. \item\end{DoxyCompactList}\item 
\hyperlink{class_asteroid}{Asteroid} $\ast$ \hyperlink{class_game_engine_ab87bb0a6801b880dab5b00d64e8738dd}{createAsteroid} (\hyperlink{gameobject_8h_a57678b60d65afb213d04a6b090c64a08}{GameObjectType} type, const \hyperlink{class_asteroid}{Asteroid} $\ast$asteroid=0)
\begin{DoxyCompactList}\small\item\em Creates an \hyperlink{class_asteroid}{Asteroid} instance of given type. \item\end{DoxyCompactList}\item 
\hyperlink{class_collectible}{Collectible} $\ast$ \hyperlink{class_game_engine_a52585d6c75331a0b9114f4ed743085dd}{createCollectible} (\hyperlink{gameobject_8h_a57678b60d65afb213d04a6b090c64a08}{GameObjectType} type, const \hyperlink{class_game_object}{GameObject} $\ast$gameObject=0)
\begin{DoxyCompactList}\small\item\em Creates a \hyperlink{class_collectible}{Collectible} instance of given type. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_af7c22c73c096c9e41895268e37cecdd7}{createBomb} (const \hyperlink{class_asteroid}{Asteroid} $\ast$asteroid)
\begin{DoxyCompactList}\small\item\em Creates a bomb collectible and appends it to the list of collectibles. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a108bc6f815a9ec48a7ccb35be6c5eb94}{addSpaceShipSteeringEffects} (int timeStepAsInt)
\begin{DoxyCompactList}\small\item\em Add steering effects for miner. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_ab6edab7bf4e0427cb0788784d5c37030}{addMissileParticleEffects} (int timeStepAsInt)
\begin{DoxyCompactList}\small\item\em Add particle effects on missiles. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a725e5635940cc10fcb0bb7824d954ba6}{addCometParticleEffects} (int timeStepAsInt)
\begin{DoxyCompactList}\small\item\em Add particle effects on comet. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a273d097954b98d80ba7d829ddab11417}{createParticleExplosion} (FPtype x, FPtype y, int particleCount, FPtype particleVelocity=0.05f)
\begin{DoxyCompactList}\small\item\em Creates a particle explosion effect. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a92340a93a97ceae121373d5908fab36b}{addBlackHoleParticles} (int timeStepAsInt)
\begin{DoxyCompactList}\small\item\em Add particle effects on black hole. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a8ec7f5cf22ea70817660e28375af567f}{addHyperJumpParticles} (int timeStepAsInt)
\begin{DoxyCompactList}\small\item\em Add hyper jump particle effects (circle of points). \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_ad495614f182737556a600a147a593935}{doBlackHoleEffect} (\hyperlink{class_game_object}{GameObject} $\ast$gameObject)
\begin{DoxyCompactList}\small\item\em Appends a black hole gravity effect on game object. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a567ce43ede37728459313242a47c04c9}{setObjectDead} (\hyperlink{class_game_object}{GameObject} $\ast$gameObject, int frame, FPtype time)
\begin{DoxyCompactList}\small\item\em Set object to ''dead'' state waiting for the possible rewind playback. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_acd585297a9283fd6567744c82d8133cc}{initNextLevel} ()
\begin{DoxyCompactList}\small\item\em Initializes the level data. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a385a685ce0e33310f6d943d1850c1398}{moreGameObjects} ()
\begin{DoxyCompactList}\small\item\em Populates game level with new game objects. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_abdb664d2ab95b86ea0ac25b548a84b34}{applyBombDestruction} ()
\begin{DoxyCompactList}\small\item\em Applies a bomb destruction effect on game objects according to bomb effect state (location and ''shock wave''-\/radius). \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_ac94663bf33cb4bde82b5fbdf8d1e5b1e}{fireMissile} (const \hyperlink{class_ufo}{Ufo} $\ast$ufo)
\begin{DoxyCompactList}\small\item\em Fires an \hyperlink{class_ufo}{Ufo} missile. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a1acf09d547f7cde080dbbe8c7c8e59df}{steerMissile} (\hyperlink{class_missile}{Missile} $\ast$missile, bool reset=false)
\begin{DoxyCompactList}\small\item\em Steers the \hyperlink{class_ufo}{Ufo} missile. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_ad96f81b3b31fba4c16cdf3843e61bbc2}{
\hyperlink{class_particle_data}{ParticleData} \& \hyperlink{class_game_engine_ad96f81b3b31fba4c16cdf3843e61bbc2}{particleData} ()}
\label{class_game_engine_ad96f81b3b31fba4c16cdf3843e61bbc2}

\begin{DoxyCompactList}\small\item\em Returns a pointer to {\ttfamily \hyperlink{class_particle_data}{ParticleData}} instance. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_aab41e253c31468827fb83e6b333a42f2}{newSoundEffect} (\hyperlink{soundengine_8h_a608db89860fa5723001cc530622ba5bf}{SoundEffectType} type)
\begin{DoxyCompactList}\small\item\em Creates a new sound effect of given type and appends it to the list of new effects. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a235198ab5df9f6cc584993e74666b1d4}{cleanUpGameObjects} (bool complete)
\begin{DoxyCompactList}\small\item\em Cleans up all the dynamically created game objects. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_aa1eb0627106e52b5efbdce6c9c40e2d9}{getStartParams} (\hyperlink{gameengine_8h_a622f68cdaded1ddf85ccecb9cfed089f}{GameObjectStartMode} mode, FPtype marginRelative, \hyperlink{struct_game_object_start_parameters}{GameObjectStartParameters} \&startParameters)
\begin{DoxyCompactList}\small\item\em Determines start parameters for a game object: start and end location, direction vector as unit vector and rotation angle. \item\end{DoxyCompactList}\item 
bool \hyperlink{class_game_engine_a2a240907bf5b16ae848cf400de404d9d}{objectivesFilled} (int \&currentObject, int \&potentialObjects) const 
\begin{DoxyCompactList}\small\item\em Checks if the objectives for current level are fulfilled. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a77715e6e5f1c77af5796f1dd0a3713f4}{cleanUpRewindFrames} (bool cleanUpAlsoGameObjects)
\begin{DoxyCompactList}\small\item\em Cleans up the rewind mode queue. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_aa18d4cabd2a97916c7e3d63b4bb2d059}{writeObjectPositions} ()
\begin{DoxyCompactList}\small\item\em Stores the game object positions for the rewind mode playback. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a4ed01c2a0d4aefefff8ea4ec213ddcb4}{initObjectsForRewindMode} (int firstFrame)
\begin{DoxyCompactList}\small\item\em Initialize game objects for the rewind mode playback. \item\end{DoxyCompactList}\item 
void \hyperlink{class_game_engine_a76ec2b4e6eac127a00db7d331f933571}{resetTimersForRewindMode} ()
\begin{DoxyCompactList}\small\item\em Reset timers for the rewind mode playback. \item\end{DoxyCompactList}\item 
QList$<$ int $>$ \hyperlink{class_game_engine_ad0854767b6f866ef7fa14b7c1c95178d}{score} ()
\begin{DoxyCompactList}\small\item\em Updates the score digits according to game score. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Private Attributes}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_game_engine_ab393a3584a94af89d4eceb656e7cbbdb}{
\hyperlink{class_sound_engine}{SoundEngine} $\ast$ \hyperlink{class_game_engine_ab393a3584a94af89d4eceb656e7cbbdb}{soundEngine}}
\label{class_game_engine_ab393a3584a94af89d4eceb656e7cbbdb}

\begin{DoxyCompactList}\small\item\em Sound engine for playing sound effects. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_ae4c5aa4fcc35d924567c5794e5e43c89}{
\hyperlink{class_timer_manager}{TimerManager} $\ast$ \hyperlink{class_game_engine_ae4c5aa4fcc35d924567c5794e5e43c89}{timerManager}}
\label{class_game_engine_ae4c5aa4fcc35d924567c5794e5e43c89}

\begin{DoxyCompactList}\small\item\em Timer manager for managing game timers. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a6552244f5c09e58c518c2e28418e039b}{
bool \hyperlink{class_game_engine_a6552244f5c09e58c518c2e28418e039b}{rewindEnabled}}
\label{class_game_engine_a6552244f5c09e58c518c2e28418e039b}

\begin{DoxyCompactList}\small\item\em Is rewind mode playback enabled. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a37a693de445d7f32d6c377335d9eb0cc}{
int \hyperlink{class_game_engine_a37a693de445d7f32d6c377335d9eb0cc}{gameScreenWidth}}
\label{class_game_engine_a37a693de445d7f32d6c377335d9eb0cc}

\begin{DoxyCompactList}\small\item\em Game screen width. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a81c2fc9b91e4730e0b5cd0fb5a808f67}{
int \hyperlink{class_game_engine_a81c2fc9b91e4730e0b5cd0fb5a808f67}{gameScreenHeight}}
\label{class_game_engine_a81c2fc9b91e4730e0b5cd0fb5a808f67}

\begin{DoxyCompactList}\small\item\em Game screen height. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a8688d1b9dfc425428a0ae287277e2f6c}{
FPtype \hyperlink{class_game_engine_a8688d1b9dfc425428a0ae287277e2f6c}{gameViewRangeX}}
\label{class_game_engine_a8688d1b9dfc425428a0ae287277e2f6c}

\begin{DoxyCompactList}\small\item\em Game viewport X-\/range. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_af2a3a8341a1ab56844e6d33f7d6166de}{
FPtype \hyperlink{class_game_engine_af2a3a8341a1ab56844e6d33f7d6166de}{gameViewRangeY}}
\label{class_game_engine_af2a3a8341a1ab56844e6d33f7d6166de}

\begin{DoxyCompactList}\small\item\em Game viewport Y-\/range. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_afa4ce367dca084fb0587783cdc4c3c47}{
FPtype \hyperlink{class_game_engine_afa4ce367dca084fb0587783cdc4c3c47}{gameViewRangeZ}}
\label{class_game_engine_afa4ce367dca084fb0587783cdc4c3c47}

\begin{DoxyCompactList}\small\item\em Game viewport Z-\/range. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a8c7ac96a2d3c7f25e37179e7b6a7513a}{
unsigned int \hyperlink{class_game_engine_a8c7ac96a2d3c7f25e37179e7b6a7513a}{totalFrameCounter}}
\label{class_game_engine_a8c7ac96a2d3c7f25e37179e7b6a7513a}

\begin{DoxyCompactList}\small\item\em Contains current frame from the game start (initialized to 0 on each game start). \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_ad7bb8fd24f2b1c2352df9f49ccc13ff0}{
FPtype \hyperlink{class_game_engine_ad7bb8fd24f2b1c2352df9f49ccc13ff0}{totalTimeCounter}}
\label{class_game_engine_ad7bb8fd24f2b1c2352df9f49ccc13ff0}

\begin{DoxyCompactList}\small\item\em Contains the current time from game start (initialized to 0 on each game start). \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a3eb65bb68ff9edfbe511da6e545098b1}{
FPtype \hyperlink{class_game_engine_a3eb65bb68ff9edfbe511da6e545098b1}{minerSteeringX}}
\label{class_game_engine_a3eb65bb68ff9edfbe511da6e545098b1}

\begin{DoxyCompactList}\small\item\em Rotation sensor readings adjusted close to range -\/1 $<$-\/$>$ +1. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_ab79f1118bfe65ee48ad6e449f5a362f6}{
FPtype \hyperlink{class_game_engine_ab79f1118bfe65ee48ad6e449f5a362f6}{minerSteeringY}}
\label{class_game_engine_ab79f1118bfe65ee48ad6e449f5a362f6}

\begin{DoxyCompactList}\small\item\em Rotation sensor readings adjusted close to range -\/1 $<$-\/$>$ +1. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a8ac06b8efacef3a79fba0b4809da012f}{
FPtype \hyperlink{class_game_engine_a8ac06b8efacef3a79fba0b4809da012f}{hyperjumpShakeZ}}
\label{class_game_engine_a8ac06b8efacef3a79fba0b4809da012f}

\begin{DoxyCompactList}\small\item\em Acceleration sensor readings adjusted close to range 0 $<$-\/$>$ 100. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a7ddfdb9ab5649e519f8f6089008d25f7}{
\hyperlink{class_space_craft}{SpaceCraft} $\ast$ \hyperlink{class_game_engine_a7ddfdb9ab5649e519f8f6089008d25f7}{miner}}
\label{class_game_engine_a7ddfdb9ab5649e519f8f6089008d25f7}

\begin{DoxyCompactList}\small\item\em Miner game object controlled by player. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_accb0e026dc51598ab883ee36635139a6}{
int \hyperlink{class_game_engine_accb0e026dc51598ab883ee36635139a6}{minerRocketLevelX}}
\label{class_game_engine_accb0e026dc51598ab883ee36635139a6}

\begin{DoxyCompactList}\small\item\em Miner rocket level for X-\/axis particle effects. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_adc59f3c05fdc870138348dd098c22cd6}{
int \hyperlink{class_game_engine_adc59f3c05fdc870138348dd098c22cd6}{minerRocketCounterX}}
\label{class_game_engine_adc59f3c05fdc870138348dd098c22cd6}

\begin{DoxyCompactList}\small\item\em Miner rocket effects counter for X-\/axis particle effects. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a12b534087e9e8dd9fe14edb1abea20ba}{
int \hyperlink{class_game_engine_a12b534087e9e8dd9fe14edb1abea20ba}{minerRocketLevelY}}
\label{class_game_engine_a12b534087e9e8dd9fe14edb1abea20ba}

\begin{DoxyCompactList}\small\item\em Miner rocket level for Y-\/axis particle effects. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_ad34796f812ff6fc21d2339a2721c4f04}{
int \hyperlink{class_game_engine_ad34796f812ff6fc21d2339a2721c4f04}{minerRocketCounterY}}
\label{class_game_engine_ad34796f812ff6fc21d2339a2721c4f04}

\begin{DoxyCompactList}\small\item\em Miner rocket effects counter for Y-\/axis particle effects. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_aa37d1d749395e72477b4a3603817f02c}{
QList$<$ \hyperlink{class_game_effect}{GameEffect} $\ast$ $>$ \hyperlink{class_game_engine_aa37d1d749395e72477b4a3603817f02c}{newEffects}}
\label{class_game_engine_aa37d1d749395e72477b4a3603817f02c}

\begin{DoxyCompactList}\small\item\em A list for storing new game effects on each game cycle, the effects are played at the end of the cycle. \item\end{DoxyCompactList}\item 
QQueue$<$ \hyperlink{class_frame_info}{FrameInfo} $\ast$ $>$ \hyperlink{class_game_engine_a807ec8861e214d63d472703a229dcc43}{frameInfoQ}
\begin{DoxyCompactList}\small\item\em For storing {\ttfamily \hyperlink{class_frame_info}{FrameInfo}} data for rewind mode playback. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a36be584a349ce33f04255061566e7c89}{
QQueue$<$ \hyperlink{class_game_effect}{GameEffect} $\ast$ $>$ \hyperlink{class_game_engine_a36be584a349ce33f04255061566e7c89}{pastEffects}}
\label{class_game_engine_a36be584a349ce33f04255061566e7c89}

\begin{DoxyCompactList}\small\item\em For storing played effects for rewind mode playback. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_af297d1a8a8b30ab12b51ac7c241f7003}{
\hyperlink{struct_statistics}{Statistics} \hyperlink{class_game_engine_af297d1a8a8b30ab12b51ac7c241f7003}{currentFrameStats}}
\label{class_game_engine_af297d1a8a8b30ab12b51ac7c241f7003}

\begin{DoxyCompactList}\small\item\em For storing game statistics information. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_aeefd1957c050b949f7911363bf57e69f}{
QList$<$ \hyperlink{class_asteroid}{Asteroid} $\ast$ $>$ \hyperlink{class_game_engine_aeefd1957c050b949f7911363bf57e69f}{asteroidList}}
\label{class_game_engine_aeefd1957c050b949f7911363bf57e69f}

\begin{DoxyCompactList}\small\item\em For storing asteroid game objects: asteroids may be ''alive'' ingame asteroids or ''dead'' asteroids for rendering rewind mode playback. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a5c114a1e9957f4cf0eaaac7a5e60d4b9}{
QList$<$ \hyperlink{class_collectible}{Collectible} $\ast$ $>$ \hyperlink{class_game_engine_a5c114a1e9957f4cf0eaaac7a5e60d4b9}{collectibleList}}
\label{class_game_engine_a5c114a1e9957f4cf0eaaac7a5e60d4b9}

\begin{DoxyCompactList}\small\item\em For storing collectible game objects: collectibles may be ''alive'' ingame collectibles or ''dead'' collectibles for rendering rewind mode playback. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_af9868f8ba59c50ff8686217f102c450a}{
QList$<$ \hyperlink{class_game_object}{GameObject} $\ast$ $>$ \hyperlink{class_game_engine_af9868f8ba59c50ff8686217f102c450a}{enemyList}}
\label{class_game_engine_af9868f8ba59c50ff8686217f102c450a}

\begin{DoxyCompactList}\small\item\em For storing enemy game objects: enemies may be ''alive'' ingame enemies or ''dead'' enemies for rendering rewind mode playback. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a229e3ca1a881bd6d7b41a6ed2aead5cb}{
\hyperlink{class_black_hole}{BlackHole} $\ast$ \hyperlink{class_game_engine_a229e3ca1a881bd6d7b41a6ed2aead5cb}{blackhole}}
\label{class_game_engine_a229e3ca1a881bd6d7b41a6ed2aead5cb}

\begin{DoxyCompactList}\small\item\em Blackhole game object. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a72232c9825c643f28fc50f334eac8b52}{
\hyperlink{class_comet}{Comet} $\ast$ \hyperlink{class_game_engine_a72232c9825c643f28fc50f334eac8b52}{comet}}
\label{class_game_engine_a72232c9825c643f28fc50f334eac8b52}

\begin{DoxyCompactList}\small\item\em \hyperlink{class_comet}{Comet} game object. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_ade644c436a878e6483fbdb1f050ffb43}{
\hyperlink{class_hyper_jump_navigator}{HyperJumpNavigator} $\ast$ \hyperlink{class_game_engine_ade644c436a878e6483fbdb1f050ffb43}{hyperJumpNavigator}}
\label{class_game_engine_ade644c436a878e6483fbdb1f050ffb43}

\begin{DoxyCompactList}\small\item\em Hyper jump navigator for computing a ''safe'' hyper jump targert location for miner. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a2fa6f866478a0a1194db45cd18ff004a}{
bool \hyperlink{class_game_engine_a2fa6f866478a0a1194db45cd18ff004a}{updateSpaceShipGraphics}}
\label{class_game_engine_a2fa6f866478a0a1194db45cd18ff004a}

\begin{DoxyCompactList}\small\item\em For requesting immidiate update on miner space ship graphics. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a362ce8f52797a04dc639c1f58441294f}{
int \hyperlink{class_game_engine_a362ce8f52797a04dc639c1f58441294f}{minersLeft}}
\label{class_game_engine_a362ce8f52797a04dc639c1f58441294f}

\begin{DoxyCompactList}\small\item\em Counter for miners left (How many ''Lives'' player has). \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a1ba36346aa3811b0f5b79882f861d786}{
QList$<$ int $>$ \hyperlink{class_game_engine_a1ba36346aa3811b0f5b79882f861d786}{triggerUfo}}
\label{class_game_engine_a1ba36346aa3811b0f5b79882f861d786}

\begin{DoxyCompactList}\small\item\em A list for \hyperlink{class_ufo}{Ufo} triggers contains the progress points where new UFOs can be appended to game screen. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a337afc0645e94cf6a3c71d50ff7ddd2e}{
QList$<$ int $>$ \hyperlink{class_game_engine_a337afc0645e94cf6a3c71d50ff7ddd2e}{triggerMeteorShower}}
\label{class_game_engine_a337afc0645e94cf6a3c71d50ff7ddd2e}

\begin{DoxyCompactList}\small\item\em A list for \hyperlink{class_meteor_shower}{MeteorShower} triggers contains the progress points whewe new meteor showers can be appended to game screen. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_afa41698c383b382cbe7aec7d26520fd4}{
QList$<$ int $>$ \hyperlink{class_game_engine_afa41698c383b382cbe7aec7d26520fd4}{triggerBlackHole}}
\label{class_game_engine_afa41698c383b382cbe7aec7d26520fd4}

\begin{DoxyCompactList}\small\item\em A list for \hyperlink{class_black_hole}{BlackHole} triggers contains the progress points where new black holes can be appended to game screen. \item\end{DoxyCompactList}\item 
\hypertarget{class_game_engine_a3f285db89576f9220174f3c27e8dc3a5}{
QList$<$ int $>$ \hyperlink{class_game_engine_a3f285db89576f9220174f3c27e8dc3a5}{triggerComet}}
\label{class_game_engine_a3f285db89576f9220174f3c27e8dc3a5}

\begin{DoxyCompactList}\small\item\em A list for \hyperlink{class_comet}{Comet} triggers contains the progress points where new comets can be appended to game screen. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Friends}
\begin{DoxyCompactItemize}
\item 
\hypertarget{class_game_engine_a2b7cb859d8128928c29d15e130375677}{
class \hyperlink{class_game_engine_a2b7cb859d8128928c29d15e130375677}{GameWidget}}
\label{class_game_engine_a2b7cb859d8128928c29d15e130375677}

\end{DoxyCompactItemize}


\subsection{Detailed Description}
The {\ttfamily \hyperlink{class_game_engine}{GameEngine}} class contains the main game loop and all the necessary methods to keep up the actual gameplay. In addition to the main game loop {\ttfamily \hyperlink{class_game_engine_a0cb4c8cd0289b828d85588f68e728153}{GameEngine::cycleGameLoop}}, the \hyperlink{class_game_engine}{GameEngine} class contains methods for:
\begin{DoxyItemize}
\item Initializing a new game and new level
\item Managing frame data for rewind mode
\item Managing game timers
\item Controlling the miner
\item Advancing game objects
\item Detecting collisions
\item Creating and processing effects (visual and sound)
\item Populating game with game objects
\item Handling miscellaus game events
\item Managing the game level progress
\item Applying bomb destruction to game objects
\item Applying blackhole force gravity force effect
\item Guiding and firing missiles
\item etc 
\end{DoxyItemize}

\subsection{Constructor \& Destructor Documentation}
\hypertarget{class_game_engine_aef6f9a129c1605dece77279e87d177fb}{
\index{GameEngine@{GameEngine}!GameEngine@{GameEngine}}
\index{GameEngine@{GameEngine}!GameEngine@{GameEngine}}
\subsubsection[{GameEngine}]{\setlength{\rightskip}{0pt plus 5cm}GameEngine::GameEngine (
\begin{DoxyParamCaption}
\item[{bool}]{ rewindEnabled, }
\item[{int}]{ difficultyLevel}
\end{DoxyParamCaption}
)}}
\label{class_game_engine_aef6f9a129c1605dece77279e87d177fb}


Constructor of {\ttfamily \hyperlink{class_game_engine}{GameEngine}} class. 

Initializes the variables and calls {\ttfamily \hyperlink{class_game_engine_a45c977471781cf798b62c8e8fd4aa200}{GameEngine::initNewGame()}} to initialize a new game.


\begin{DoxyParams}{Parameters}
\item[{\em rewindEnabled}]True if the \char`\"{}rewind\char`\"{}-\/mode is enabled. \item[{\em difficultyLevel}]Difficulty level of the game from settings (1 = Easy, 2 = Normal, 3 = Hard) \end{DoxyParams}
\hypertarget{class_game_engine_a8e59d8341ef9d2dcc62eee1437e37f14}{
\index{GameEngine@{GameEngine}!$\sim$GameEngine@{$\sim$GameEngine}}
\index{$\sim$GameEngine@{$\sim$GameEngine}!GameEngine@{GameEngine}}
\subsubsection[{$\sim$GameEngine}]{\setlength{\rightskip}{0pt plus 5cm}GameEngine::$\sim$GameEngine (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)}}
\label{class_game_engine_a8e59d8341ef9d2dcc62eee1437e37f14}


Destructor of {\ttfamily \hyperlink{class_game_engine}{GameEngine}} class. 

Cleans up all the game objects 

\subsection{Member Function Documentation}
\hypertarget{class_game_engine_a92340a93a97ceae121373d5908fab36b}{
\index{GameEngine@{GameEngine}!addBlackHoleParticles@{addBlackHoleParticles}}
\index{addBlackHoleParticles@{addBlackHoleParticles}!GameEngine@{GameEngine}}
\subsubsection[{addBlackHoleParticles}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::addBlackHoleParticles (
\begin{DoxyParamCaption}
\item[{int}]{ timeStepAsInt}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a92340a93a97ceae121373d5908fab36b}


Add particle effects on black hole. 

Amount of particles is depends of the time step for current game loop cycle. \hyperlink{struct_particle}{Particle} effects are appended into ''particle buffer'' accessed using {\ttfamily \hyperlink{class_game_engine_ad96f81b3b31fba4c16cdf3843e61bbc2}{GameEngine::particleData()}}.


\begin{DoxyParams}{Parameters}
\item[{\em timeStepAsInt}]Time step calculated for current game cycle as an integer value. \end{DoxyParams}
\hypertarget{class_game_engine_a725e5635940cc10fcb0bb7824d954ba6}{
\index{GameEngine@{GameEngine}!addCometParticleEffects@{addCometParticleEffects}}
\index{addCometParticleEffects@{addCometParticleEffects}!GameEngine@{GameEngine}}
\subsubsection[{addCometParticleEffects}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::addCometParticleEffects (
\begin{DoxyParamCaption}
\item[{int}]{ timeStepAsInt}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a725e5635940cc10fcb0bb7824d954ba6}


Add particle effects on comet. 

Amount of particles is determined using the time step for current game loop cycle. \hyperlink{struct_particle}{Particle} effects are appended into ''particle buffer'' accessed using {\ttfamily \hyperlink{class_game_engine_ad96f81b3b31fba4c16cdf3843e61bbc2}{GameEngine::particleData()}}.


\begin{DoxyParams}{Parameters}
\item[{\em timeStepAsInt}]Time step calculated for current game cycle as an integer value. \end{DoxyParams}
\hypertarget{class_game_engine_a8ec7f5cf22ea70817660e28375af567f}{
\index{GameEngine@{GameEngine}!addHyperJumpParticles@{addHyperJumpParticles}}
\index{addHyperJumpParticles@{addHyperJumpParticles}!GameEngine@{GameEngine}}
\subsubsection[{addHyperJumpParticles}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::addHyperJumpParticles (
\begin{DoxyParamCaption}
\item[{int}]{ timeStepAsInt}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a8ec7f5cf22ea70817660e28375af567f}


Add hyper jump particle effects (circle of points). 

Amount of particles is depends of the time step for current game loop cycle. Computes a set of fixed angles (full circle divided to parts) creating a circle of points.

\hyperlink{struct_particle}{Particle} effects are appended into ''particle buffer'' accessed using {\ttfamily \hyperlink{class_game_engine_ad96f81b3b31fba4c16cdf3843e61bbc2}{GameEngine::particleData()}}.


\begin{DoxyParams}{Parameters}
\item[{\em timeStepAsInt}]Time step calculated for current game cycle as an integer value. \end{DoxyParams}
\hypertarget{class_game_engine_ab6edab7bf4e0427cb0788784d5c37030}{
\index{GameEngine@{GameEngine}!addMissileParticleEffects@{addMissileParticleEffects}}
\index{addMissileParticleEffects@{addMissileParticleEffects}!GameEngine@{GameEngine}}
\subsubsection[{addMissileParticleEffects}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::addMissileParticleEffects (
\begin{DoxyParamCaption}
\item[{int}]{ timeStepAsInt}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_ab6edab7bf4e0427cb0788784d5c37030}


Add particle effects on missiles. 

Missiles are collected into a vector from enemyList. Amount of particles is determined using the time step for current game loop cycle. \hyperlink{struct_particle}{Particle} effects are appended into ''particle buffer'' accessed using {\ttfamily \hyperlink{class_game_engine_ad96f81b3b31fba4c16cdf3843e61bbc2}{GameEngine::particleData()}}.


\begin{DoxyParams}{Parameters}
\item[{\em timeStepAsInt}]Time step calculated for current game cycle as an integer value. \end{DoxyParams}
\hypertarget{class_game_engine_a108bc6f815a9ec48a7ccb35be6c5eb94}{
\index{GameEngine@{GameEngine}!addSpaceShipSteeringEffects@{addSpaceShipSteeringEffects}}
\index{addSpaceShipSteeringEffects@{addSpaceShipSteeringEffects}!GameEngine@{GameEngine}}
\subsubsection[{addSpaceShipSteeringEffects}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::addSpaceShipSteeringEffects (
\begin{DoxyParamCaption}
\item[{int}]{ timeStepAsInt}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a108bc6f815a9ec48a7ccb35be6c5eb94}


Add steering effects for miner. 

Steering effects mimic space ship rocket effects using particle graphics.

There are three ''levels'' for the effect. Each level has
\begin{DoxyItemize}
\item a ''rocket level limit''
\item an interval, how many milliseconds is passed between particle launches
\item a particle velocity
\end{DoxyItemize}

The effect level is determined according to steering value (direction and steepness) for both X-\/ and Y-\/axels ({\ttfamily minerSteeringX} and {\ttfamily minerSteeringY}).

\hyperlink{struct_particle}{Particle} effects are appended into ''particle buffer''.


\begin{DoxyParams}{Parameters}
\item[{\em timeStepAsInt}]Time step calculated for current game cycle as an integer value. \end{DoxyParams}
\hypertarget{class_game_engine_aae2169c42cd517e0989e8a03c9e36b3e}{
\index{GameEngine@{GameEngine}!advanceGameObjects@{advanceGameObjects}}
\index{advanceGameObjects@{advanceGameObjects}!GameEngine@{GameEngine}}
\subsubsection[{advanceGameObjects}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::advanceGameObjects (
\begin{DoxyParamCaption}
\item[{FPtype}]{ timestep}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_aae2169c42cd517e0989e8a03c9e36b3e}


Advances all the game objects according to given timestep. 

To add new enemies set instructions for your enemy type in switch-\/case clause in {\ttfamily enemyList} loop, e.g.


\begin{DoxyCode}
 switch (go->objectType()) {
     case TypeUfo:
         u = static_cast<Ufo *>(go);
         u->doUfoSteering(timestep);
         integrateMotion(u, timestep);
         u->integrateRotation(timestep);
         u = NULL;
         break;
     ...
 }
\end{DoxyCode}


{\ttfamily \hyperlink{class_game_engine_a66036f5a81212b0cc98726f0df8ff270}{GameEngine::integrateMotion}} sets a new location for game object. If the game object is a {\ttfamily \hyperlink{class_rotating_object}{RotatingObject}}, {\ttfamily \hyperlink{class_rotating_object_a746d2fdd9b705c9db92bbeab7295113b}{RotatingObject::integrateRotation()}} is used to integarte rotation. In the example above an additional steering effect is made before relocating the object.

Integrates also the effect of black hole ''gravity'' on game objects if a black hole exists using {\ttfamily \hyperlink{class_game_engine_ad495614f182737556a600a147a593935}{GameEngine::doBlackHoleEffect()}}. Checks also if game objects were sucked into the black hole.

Checks if the game objects are wrapping from side of the screen to opposite side using {\ttfamily GameObject::checkWrapping()}. If the miner has wrapped starts a ''ship safe'' timer ({\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548ad1f8e4fd830fe397eeb3bf16bd30187f}{GameTimer::shipSafeTimer}}). Miner movement is blocked if ''Get Ready'' timer is active or miner is executing a hyper jump.

The life time of collectibles is checked. Current progress is incremented when a collectible expires and the collectible is set dead:


\begin{DoxyCode}
 if (!c->lifeCycleLeft(totalFrameCounter) && c->objectType() == TypeCollectible) 
      {
      currentLevelProgress[0] += ProgressOther;
      setObjectDead(c, totalFrameCounter, totalTimeCounter);
 }
\end{DoxyCode}



\begin{DoxyParams}{Parameters}
\item[{\em timestep}]A timestep in milliseconds (calculated frame length). \end{DoxyParams}
\hypertarget{class_game_engine_abdb664d2ab95b86ea0ac25b548a84b34}{
\index{GameEngine@{GameEngine}!applyBombDestruction@{applyBombDestruction}}
\index{applyBombDestruction@{applyBombDestruction}!GameEngine@{GameEngine}}
\subsubsection[{applyBombDestruction}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::applyBombDestruction (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_abdb664d2ab95b86ea0ac25b548a84b34}


Applies a bomb destruction effect on game objects according to bomb effect state (location and ''shock wave''-\/radius). 

\hyperlink{class_bomb}{Bomb} effect data (location and radius) is stored as static data to \hyperlink{class_timer_manager_a6d52e10b41b535e8e394de70efee4580}{TimerManager::bombEffectData}.

When checking if bomb destruction will be applied on a game object, the distance square (to prevent calculating root square) between game object and bomb effect is calculated. If the distance is inside the shock wave radius, the game object will be set to ''dead''-\/state. The player's score will be incremented according to the score value of a game object and a particle explosion effect will be presented. Also the current level progress will be inceremented according to the progress value of the item in question.

This method should be called only if {\ttfamily bombEffectTimer} is active. {\ttfamily bombEffectTimer} activates after the player launches a bomb. When the {\ttfamily bombEffectTimer} is active also the {\ttfamily \hyperlink{class_timer_manager_a6d52e10b41b535e8e394de70efee4580}{TimerManager::bombEffectData}} is assumed to have valid data. \hypertarget{class_game_engine_ae8e27bd2226d8092117a2627dde79579}{
\index{GameEngine@{GameEngine}!changeShipModeDelayed@{changeShipModeDelayed}}
\index{changeShipModeDelayed@{changeShipModeDelayed}!GameEngine@{GameEngine}}
\subsubsection[{changeShipModeDelayed}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::changeShipModeDelayed (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_ae8e27bd2226d8092117a2627dde79579}


Change the ship mode delayed using timer. 

If either of the ship mode timers is running, then start an opposite timer. Otherwise start the timer based on current ship mode. Appends the effect to the list of new effects to be started at the end of current game cycle. \hypertarget{class_game_engine_a235198ab5df9f6cc584993e74666b1d4}{
\index{GameEngine@{GameEngine}!cleanUpGameObjects@{cleanUpGameObjects}}
\index{cleanUpGameObjects@{cleanUpGameObjects}!GameEngine@{GameEngine}}
\subsubsection[{cleanUpGameObjects}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::cleanUpGameObjects (
\begin{DoxyParamCaption}
\item[{bool}]{ complete}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a235198ab5df9f6cc584993e74666b1d4}


Cleans up all the dynamically created game objects. 

\hyperlink{class_asteroid}{Asteroid}, collectible and enemy lists will be cleaned up and the objects are deleted. Blackhole and comet objects are deleted. If a ''complete cleanup'' is requested also the {\ttfamily miner}, {\ttfamily level} and {\ttfamily hyperJumpNavigator} objects will be deleted.


\begin{DoxyParams}{Parameters}
\item[{\em complete}]If set to true a complete cleanup for dynamic objects will be executed. \end{DoxyParams}
\hypertarget{class_game_engine_a77715e6e5f1c77af5796f1dd0a3713f4}{
\index{GameEngine@{GameEngine}!cleanUpRewindFrames@{cleanUpRewindFrames}}
\index{cleanUpRewindFrames@{cleanUpRewindFrames}!GameEngine@{GameEngine}}
\subsubsection[{cleanUpRewindFrames}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::cleanUpRewindFrames (
\begin{DoxyParamCaption}
\item[{bool}]{ cleanUpAlsoGameObjects}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a77715e6e5f1c77af5796f1dd0a3713f4}


Cleans up the rewind mode queue. 

Dequeues the {\ttfamily \hyperlink{class_frame_info}{FrameInfo}} objects and deletes them. Cleans up also game objects if requested.


\begin{DoxyParams}{Parameters}
\item[{\em cleanUpAlsoGameObjects}]If set to true the game objects will be also cleaned up. \end{DoxyParams}
\hypertarget{class_game_engine_a18954e6a69916acac6a548b10532d310}{
\index{GameEngine@{GameEngine}!controlGameEvents@{controlGameEvents}}
\index{controlGameEvents@{controlGameEvents}!GameEngine@{GameEngine}}
\subsubsection[{controlGameEvents}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::controlGameEvents (
\begin{DoxyParamCaption}
\item[{FPtype}]{ timestep}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a18954e6a69916acac6a548b10532d310}


Handles misc game events which. 


\begin{DoxyEnumerate}
\item are not direct consequences of \hyperlink{class_game_object}{GameObject} movement and collisions.
\item depend on game difficulty level and/or are of random nature.
\end{DoxyEnumerate}

For example UFO shooting missiles: 
\begin{DoxyCode}
 if (t == TypeUfo) {
     ...
     Ufo *u = static_cast<Ufo *>(go);
     fireMissile(u);
     ...
 }
\end{DoxyCode}


Makes UFO's to shoot missiles and guide the missiles. Missiles are shoot ({\ttfamily \hyperlink{class_game_engine_ac94663bf33cb4bde82b5fbdf8d1e5b1e}{GameEngine::fireMissile()}}) randomly depending on the {\ttfamily \hyperlink{struct_game_level_data_a18ba8b9208d77c80530d5bf23da9d894}{GameLevelData::missileIncidence}} value for current level. Depending on the {\ttfamily \hyperlink{struct_game_level_data_a9689b81089ff90a6269eea879d3d55d4}{GameLevelData::missileGuidance}} the missile is steered by calling {\ttfamily \hyperlink{class_game_engine_a1acf09d547f7cde080dbbe8c7c8e59df}{GameEngine::steerMissile()}}.

This is method executed only if the game is in ''normal'' gameplay state -\/ if none of the following game state timers are running
\begin{DoxyItemize}
\item {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548afab4541f520311a3a67010c7c66be9e9}{GameTimer::stateGetReadyTimer}} 
\item {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548a7b843da3fffbf65897071c53c487156c}{GameTimer::stateLevelChangingTimer}} 
\item {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548af27524cbeb81ecfd1b861538c76bf959}{GameTimer::stateGameOverTimer}} 
\end{DoxyItemize}

Updates the meteor shower radius values for collisin detection. Meteor shower radius expands.

Calls {\ttfamily \hyperlink{class_game_engine_a385a685ce0e33310f6d943d1850c1398}{GameEngine::moreGameObjects()}} to populate game level with more game objects. \hypertarget{class_game_engine_a405e665741d74ca2062016bfcf940f68}{
\index{GameEngine@{GameEngine}!controlSpaceShip@{controlSpaceShip}}
\index{controlSpaceShip@{controlSpaceShip}!GameEngine@{GameEngine}}
\subsubsection[{controlSpaceShip}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::controlSpaceShip (
\begin{DoxyParamCaption}
\item[{FPtype}]{ timestep}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a405e665741d74ca2062016bfcf940f68}


Sets the miner's velocity based on steering information. 


\begin{DoxyParams}{Parameters}
\item[{\em timestep}]A timestep in milliseconds (calculated frame length). \end{DoxyParams}
\hypertarget{class_game_engine_ab87bb0a6801b880dab5b00d64e8738dd}{
\index{GameEngine@{GameEngine}!createAsteroid@{createAsteroid}}
\index{createAsteroid@{createAsteroid}!GameEngine@{GameEngine}}
\subsubsection[{createAsteroid}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Asteroid} $\ast$ GameEngine::createAsteroid (
\begin{DoxyParamCaption}
\item[{{\bf GameObjectType}}]{ type, }
\item[{const {\bf Asteroid} $\ast$}]{ p = {\ttfamily 0}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_ab87bb0a6801b880dab5b00d64e8738dd}


Creates an \hyperlink{class_asteroid}{Asteroid} instance of given type. 

Used for creating a large asteroid instance or a medium sized asteroid when splitting a large asteroid.


\begin{DoxyParams}{Parameters}
\item[{\em type}]One of the collectible types in enumeration \hyperlink{gameobject_8h_a57678b60d65afb213d04a6b090c64a08}{GameObjectType} (\hyperlink{gameobject_8h_a57678b60d65afb213d04a6b090c64a08a1ad1f4ba34086b701aedcd0fc6d8d15f}{TypeAsteroidLarge}, \hyperlink{gameobject_8h_a57678b60d65afb213d04a6b090c64a08a66824103f1b2053229e76cb18fa87446}{TypeAsteroidMediumA}, \hyperlink{gameobject_8h_a57678b60d65afb213d04a6b090c64a08ae1f0c156f9ca3ca11aab6a6d99ec40d8}{TypeAsteroidMediumB}, \hyperlink{gameobject_8h_a57678b60d65afb213d04a6b090c64a08a0828b0b12c4ff81e98a71a54b0ce60e5}{TypeAsteroidMediumC}) \item[{\em p}]Optional ''parent'' asteroid, passed when splitting a large asteroid.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
An \hyperlink{class_asteroid}{Asteroid} instance of given type. 
\end{DoxyReturn}
\hypertarget{class_game_engine_af7c22c73c096c9e41895268e37cecdd7}{
\index{GameEngine@{GameEngine}!createBomb@{createBomb}}
\index{createBomb@{createBomb}!GameEngine@{GameEngine}}
\subsubsection[{createBomb}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::createBomb (
\begin{DoxyParamCaption}
\item[{const {\bf Asteroid} $\ast$}]{ asteroid}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_af7c22c73c096c9e41895268e37cecdd7}


Creates a bomb collectible and appends it to the list of collectibles. 


\begin{DoxyParams}{Parameters}
\item[{\em asteroid}]A ''host'' asteroid for bomb, the initial location of the bomb. \end{DoxyParams}
\hypertarget{class_game_engine_a52585d6c75331a0b9114f4ed743085dd}{
\index{GameEngine@{GameEngine}!createCollectible@{createCollectible}}
\index{createCollectible@{createCollectible}!GameEngine@{GameEngine}}
\subsubsection[{createCollectible}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Collectible} $\ast$ GameEngine::createCollectible (
\begin{DoxyParamCaption}
\item[{{\bf GameObjectType}}]{ type, }
\item[{const {\bf GameObject} $\ast$}]{ gameObject = {\ttfamily 0}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a52585d6c75331a0b9114f4ed743085dd}


Creates a \hyperlink{class_collectible}{Collectible} instance of given type. 

The collectible receives it's location from the given ''host'' game object. Also the velocity is calculated from the ''host'' objects velocity.


\begin{DoxyParams}{Parameters}
\item[{\em type}]One of the collectible types in enumeration \hyperlink{gameobject_8h_a57678b60d65afb213d04a6b090c64a08}{GameObjectType} (\hyperlink{gameobject_8h_a57678b60d65afb213d04a6b090c64a08a02e188ace7d45655c353c0eab8a8ad08}{TypeCollectibleBomb}, \hyperlink{gameobject_8h_a57678b60d65afb213d04a6b090c64a08a414a75f7ed66b14f653460359bfef4cf}{TypeCollectibleHyperJump}, \hyperlink{gameobject_8h_a57678b60d65afb213d04a6b090c64a08ab11dd18bf557d69bec2a8bec8b14f712}{TypeCollectibleMineralA}, \hyperlink{gameobject_8h_a57678b60d65afb213d04a6b090c64a08a963717dea8abcaba1361ec4e645fdb6d}{TypeCollectibleMineralB}, \hyperlink{gameobject_8h_a57678b60d65afb213d04a6b090c64a08a848afa2f4dd711d51cd9bf910cad7a22}{TypeCollectibleMineralC} or \hyperlink{gameobject_8h_a57678b60d65afb213d04a6b090c64a08aeb44036d76b8bb08fbb389686d998b71}{TypeCollectibleMineralD}). \item[{\em gameObject}]''Host'' game object for collectible.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A \hyperlink{class_collectible}{Collectible} instance of given type. 
\end{DoxyReturn}
\hypertarget{class_game_engine_a273d097954b98d80ba7d829ddab11417}{
\index{GameEngine@{GameEngine}!createParticleExplosion@{createParticleExplosion}}
\index{createParticleExplosion@{createParticleExplosion}!GameEngine@{GameEngine}}
\subsubsection[{createParticleExplosion}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::createParticleExplosion (
\begin{DoxyParamCaption}
\item[{FPtype}]{ x, }
\item[{FPtype}]{ y, }
\item[{int}]{ particleCount, }
\item[{FPtype}]{ particleVelocity = {\ttfamily 0.05f}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a273d097954b98d80ba7d829ddab11417}


Creates a particle explosion effect. 

\hyperlink{struct_particle}{Particle} effect is store into a ''particle buffer'' accessed with {\ttfamily \hyperlink{class_game_engine_ad96f81b3b31fba4c16cdf3843e61bbc2}{GameEngine::particleData()}}.


\begin{DoxyParams}{Parameters}
\item[{\em x}]X-\/coordinate location for particle effect. \item[{\em y}]Y-\/coordinate location for particle effect. \item[{\em particleCount}]Amout of particles rendered for the effect \item[{\em particleVelocity}]Velocity of the particle movement \end{DoxyParams}
\hypertarget{class_game_engine_a0cb4c8cd0289b828d85588f68e728153}{
\index{GameEngine@{GameEngine}!cycleGameLoop@{cycleGameLoop}}
\index{cycleGameLoop@{cycleGameLoop}!GameEngine@{GameEngine}}
\subsubsection[{cycleGameLoop}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::cycleGameLoop (
\begin{DoxyParamCaption}
\item[{FPtype}]{ timestep}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a0cb4c8cd0289b828d85588f68e728153}


The main game loop of the SmashMiner-\/game. 

Controls the game events, e.g.:
\begin{DoxyItemize}
\item Initializes new frame data for rewind mode ({\ttfamily \hyperlink{class_game_engine_ae936fa53b2e5a145864bebc0a9d6598e}{GameEngine::initializeFrame()}}).
\item Updates the game timers and takes action regarding the state of running timers ({\ttfamily \hyperlink{class_game_engine_a1b776db2514918c20a36018fc29497cc}{GameEngine::handleGameTimers()}}).
\item Advances and controls game objects ({\ttfamily \hyperlink{class_game_engine_aae2169c42cd517e0989e8a03c9e36b3e}{GameEngine::advanceGameObjects()}}, {\ttfamily \hyperlink{class_game_engine_a405e665741d74ca2062016bfcf940f68}{GameEngine::controlSpaceShip()}})
\item Adds particle effects ({\ttfamily \hyperlink{class_game_engine_a108bc6f815a9ec48a7ccb35be6c5eb94}{GameEngine::addSpaceShipSteeringEffects()}}, {\ttfamily \hyperlink{class_game_engine_ab6edab7bf4e0427cb0788784d5c37030}{GameEngine::addMissileParticleEffects()}}, {\ttfamily \hyperlink{class_game_engine_a725e5635940cc10fcb0bb7824d954ba6}{GameEngine::addCometParticleEffects()}}, {\ttfamily \hyperlink{class_game_engine_a92340a93a97ceae121373d5908fab36b}{GameEngine::addBlackHoleParticles()}}, {\ttfamily \hyperlink{class_game_engine_a8ec7f5cf22ea70817660e28375af567f}{GameEngine::addHyperJumpParticles()}})
\item Detectes collisions between game objects ({\ttfamily \hyperlink{class_game_engine_a6e804b50ae2d2d7b4ce557b8323d0a47}{GameEngine::detectCollisions()}}).
\item Handles misc game events ({\ttfamily \hyperlink{class_game_engine_a18954e6a69916acac6a548b10532d310}{GameEngine::controlGameEvents()}})
\item Removes expired game objects ({\ttfamily \hyperlink{class_game_engine_ad1ec13623508f3c942d8730f0e8e58bd}{GameEngine::removeUnnecessaryObjects()}})
\item If rewind is enabled, stores object positions for rewind mode playback ({\ttfamily \hyperlink{class_game_engine_aa18d4cabd2a97916c7e3d63b4bb2d059}{GameEngine::writeObjectPositions()}}).
\item Process the game effects enqueued during the current game cycle ({\ttfamily \hyperlink{class_game_engine_a4082ada6ed021d5dbc87bac033d4a70b}{GameEngine::processNewEffects()}}).
\end{DoxyItemize}


\begin{DoxyParams}{Parameters}
\item[{\em timestep}]A timestep calculated for current game cycle (current game frame length) in milliseconds. \end{DoxyParams}
\hypertarget{class_game_engine_a5aea019c22835941c258710378f829d0}{
\index{GameEngine@{GameEngine}!detect@{detect}}
\index{detect@{detect}!GameEngine@{GameEngine}}
\subsubsection[{detect}]{\setlength{\rightskip}{0pt plus 5cm}bool GameEngine::detect (
\begin{DoxyParamCaption}
\item[{const {\bf GameObject} $\ast$}]{ gameObjectA, }
\item[{const {\bf GameObject} $\ast$}]{ gameObjectB}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a5aea019c22835941c258710378f829d0}


Used for testing if collision has occured between game object A and B. 

Each game object has a radius which is used in collision testing. First a rough collision testing is done by comparing X and Y locations of game objects. X-\/ and Y-\/distance and a ''collision distance'' is used in the collision testing.

X-\/distance is the difference between X-\/coordinates: 
\begin{DoxyCode}
 distanceX = fabs(gameObjectA->posX() - gameObjectB->posX());
\end{DoxyCode}
 Y-\/distance is the difference between Y-\/coordinates accordingly.

The ''collision distance'' is a sum of radius' of game object A and B: 
\begin{DoxyCode}
 collisionDistance = gameObjectA->objectRadius() + gameObjectB->objectRadius();
\end{DoxyCode}


In this case collision might occur, so more precise collision testing is done: 
\begin{DoxyCode}
 if (distanceX < collisionDistance && distanceY < collisionDistance) {
      // ... 
 }
\end{DoxyCode}


In more precise collision testing the sum of squares of X-\/ and Y-\/distances is compared to square of ''collision distance'' as in Pythagorean theorem $c^2 = a^2 + b^2$: 
\begin{DoxyCode}
  if (distanceX * distanceX + distanceY * distanceY < collisionDistance * collisi
      onDistance) {
      // ...
  }
\end{DoxyCode}



\begin{DoxyParams}{Parameters}
\item[{\em gameObjectA}]A game object \item[{\em gameObjectB}]A game object \end{DoxyParams}
\begin{DoxyReturn}{Returns}
True if collision is detected. 
\end{DoxyReturn}
\hypertarget{class_game_engine_a6e804b50ae2d2d7b4ce557b8323d0a47}{
\index{GameEngine@{GameEngine}!detectCollisions@{detectCollisions}}
\index{detectCollisions@{detectCollisions}!GameEngine@{GameEngine}}
\subsubsection[{detectCollisions}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::detectCollisions (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a6e804b50ae2d2d7b4ce557b8323d0a47}


Main entry point for collision detection between game objects. 

First asteroid list will be iterated and asteroid to asteroid collisions are tested.

Before testing collision between game objects, it's tested if a game object is ''alive''. If the rewind mode is enabled a game object may exist in ''dead'' state waiting for the possible rewind playback. If a game object is not ''alive'' it's not rendered to game screen and there's no use for collision testing:


\begin{DoxyCode}
    for (int j = i + 1; j < astCount; j++) {
      Asteroid *aj = asteroidList[j];
      if (!aj->isAlive())
          continue;
      // ...
    }
\end{DoxyCode}


The actual collision detection is done by calling the {\ttfamily \hyperlink{class_game_engine_a5aea019c22835941c258710378f829d0}{GameEngine::detect()}} method with the two game objects being tested as arguments:


\begin{DoxyCode}
 if (detect(ai, aj) && aj->isCollidable(totalFrameCounter))
      handleBumpCollision(ai, aj);
\end{DoxyCode}


The {\ttfamily \hyperlink{class_game_object_a24f6e4f3c76e4fd511a70b0cfb1880aa}{GameObject::isCollidable()}} method is used for ensuring that a new collision between game objecs is not too soon. A new object has collision free frames -\/-\/-\/ during the collision free frames the {\ttfamily \hyperlink{class_game_object_a24f6e4f3c76e4fd511a70b0cfb1880aa}{GameObject::isCollidable()}} method returns false and collision will not be handled.

If miner is alive then collision between miner and other game objects is tested. If miner is in cone mode and has collided with a collectible the {\ttfamily \hyperlink{class_game_engine_a4a3c43561e4bf844c70e7d5889b45c95}{GameEngine::handleMinerCollectibleCollision()}} is called.

If miner collides with an asteroid the {\ttfamily \hyperlink{class_game_engine_a80076a8cc8c78b4401cc4c0f92fcd07e}{GameEngine::handleMinerAsteroidCollision()}} method is called. If miner collides with an enemy object (\hyperlink{class_ufo}{Ufo}, meteor shower, comet, missile) {\ttfamily \hyperlink{class_game_engine_aa9111a6e3ccd429d86414c9aa3ccb6c3}{GameEngine::handlePlayerCrash()}} is called. \hypertarget{class_game_engine_ad495614f182737556a600a147a593935}{
\index{GameEngine@{GameEngine}!doBlackHoleEffect@{doBlackHoleEffect}}
\index{doBlackHoleEffect@{doBlackHoleEffect}!GameEngine@{GameEngine}}
\subsubsection[{doBlackHoleEffect}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::doBlackHoleEffect (
\begin{DoxyParamCaption}
\item[{{\bf GameObject} $\ast$}]{ gameObject}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_ad495614f182737556a600a147a593935}


Appends a black hole gravity effect on game object. 

If game object is close enough to black hole center it gets sucked in. First a {\ttfamily BlackHoleLethalDistance} value is calculated using black hole radius and game object radius: 
\begin{DoxyCode}
 BlackHoleLethalDistance = blackhole->objectRadius() - gameObject->objectRadius()
       * 0.75f;
\end{DoxyCode}


A vector from game object to black hole is calculated. Distance between black hole and game object is calculated from vector using Pythagorean theorem $c=\sqrt{a^2+b^2}$: 
\begin{DoxyCode}
 gameObjectToBlackHoleX = blackHoleX - gameObjectX;
 gameObjectToBlackHoleY = blackHoleY - gameObjectY;
 gameObjectToBlackHoleDistance = sqrt(gameObjectToBlackHoleX * gameObjectToBlackH
      oleX 
          + gameObjectToBlackHoleY * gameObjectToBlackHoleY);
\end{DoxyCode}


If game object is inside the black hole lethal distance ({\ttfamily BlackHoleLethalDistance}) the game object is set into ''dead'' state.

If game object is inside the black hole effect distance defined in {\ttfamily \hyperlink{class_game_engine_a962f8e20ee87669b8f9a367deef0d002}{GameEngine::BlackHoleEffectDistance}} the black hole effect gravity effect is appended.

The vector from game object to black hole is scaled into an unit vector.


\begin{DoxyCode}
 gameObjectToBlackHoleX /= gameObjectToBlackHoleDistance;
 gameObjectToBlackHoleY /= gameObjectToBlackHoleDistance;
\end{DoxyCode}


A black hole gravity impact factor from values 0.0 to 1.0 is calculated. The impact is near zero when the distance is great and it goes near 1 when game object is near black hole. 
\begin{DoxyCode}
 blackHoleFactor = 1.0 - ((gameObjectToBlackHoleDistance - BlackHoleLethalDistanc
      e)
      / (BlackHoleEffectDistance - BlackHoleLethalDistance));
\end{DoxyCode}


The impact factor is adjusted according to game object mass. The larger the mass the less the gravity impact.

The acceleration formula towards the black hole is $abx^2$ where
\begin{DoxyItemize}
\item a is a black hole force factor defined in {\ttfamily \hyperlink{class_game_engine_ae10f0c78a5cd136c6d43d7e6ad35b31a}{GameEngine::BlackHoleForce}:} 
\item b is the object's mass factor ({\ttfamily massFactor}) and
\item x is the black hole gravity impact factor ({\ttfamily blackHoleFactor})
\end{DoxyItemize}


\begin{DoxyCode}
 acceleration = BlackHoleForce * massFactor * blackHoleFactor * blackHoleFactor;
\end{DoxyCode}


The direction vector is scaled into a gravity vector. 
\begin{DoxyCode}
 gameObjectToBlackHoleX *= acceleration;
 gameObjectToBlackHoleY *= acceleration;
\end{DoxyCode}


Finally the game object's velocity vector is adjusted using the black hole gravity vector. 
\begin{DoxyCode}
 gameObject->setVelX(gameObject->velX() + gameObjectToBlackHoleX);
 gameObject->setVelY(gameObject->velY() + gameObjectToBlackHoleY);
\end{DoxyCode}
 \hypertarget{class_game_engine_ac94663bf33cb4bde82b5fbdf8d1e5b1e}{
\index{GameEngine@{GameEngine}!fireMissile@{fireMissile}}
\index{fireMissile@{fireMissile}!GameEngine@{GameEngine}}
\subsubsection[{fireMissile}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::fireMissile (
\begin{DoxyParamCaption}
\item[{const {\bf Ufo} $\ast$}]{ ufo}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_ac94663bf33cb4bde82b5fbdf8d1e5b1e}


Fires an \hyperlink{class_ufo}{Ufo} missile. 

New {\ttfamily \hyperlink{class_missile}{Missile}} object is instantiated with guidance and speed factor from level data ({\ttfamily levelData.missileGuidance} and {\ttfamily levelData.missileSpeed}). \hyperlink{class_missile}{Missile} gets the start position from the \hyperlink{class_ufo}{Ufo} object. The {\ttfamily \hyperlink{class_game_engine_a1acf09d547f7cde080dbbe8c7c8e59df}{GameEngine::steerMissile()}} is called with {\ttfamily reset=true} argument to initialize the missile direction. \hyperlink{class_missile}{Missile} object is appended to {\ttfamily enemyList}.


\begin{DoxyParams}{Parameters}
\item[{\em ufo}]The {\ttfamily \hyperlink{class_ufo}{Ufo}} instance firing a missile. \end{DoxyParams}
\hypertarget{class_game_engine_aa1eb0627106e52b5efbdce6c9c40e2d9}{
\index{GameEngine@{GameEngine}!getStartParams@{getStartParams}}
\index{getStartParams@{getStartParams}!GameEngine@{GameEngine}}
\subsubsection[{getStartParams}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::getStartParams (
\begin{DoxyParamCaption}
\item[{{\bf GameObjectStartMode}}]{ mode, }
\item[{FPtype}]{ marginRelative, }
\item[{{\bf GameObjectStartParameters} \&}]{ startParameters}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_aa1eb0627106e52b5efbdce6c9c40e2d9}


Determines start parameters for a game object: start and end location, direction vector as unit vector and rotation angle. 

If direction is not defined ({\ttfamily GameObjectStartMode::AnyDirection}) the direction is randomized between horizontal and vertical direction.

Determine a startpoint and an endpoint from the opposite edges of the game viewing area. When creating a horizontal direction the positive and negative view X-\/range values are used by adjusting values with {\ttfamily marginRelative} factor (usually to achieve off-\/screen locations):


\begin{DoxyCode}
 startX = -marginRelative * gameViewRangeX;
 endX = +marginRelative * gameViewRangeX;
\end{DoxyCode}


The starting Y-\/location is factor is calculated by adding {\ttfamily random} value to {\ttfamily shift} value. The {\ttfamily endY} factor value is calculated by subtracting {\ttfamily random} value from {\ttfamily shift} value: 
\begin{DoxyCode}
 shift = 0.7f * (getRandomF() - 0.50f);
 random = 1.4f * (getRandomF() - 0.50f);
 startY = shift + random;
 endY = shift - random;
\end{DoxyCode}


When calculating horizontal direction the start and end Y-\/coordinates must not be off-\/screen locations. The {\ttfamily startY} and {\ttfamily endY} values are checked agains {\ttfamily limit} value to prevent off-\/screen values: 
\begin{DoxyCode}
 if (startY < -limit) startY = -limit;
 if (startY > +limit) startY = +limit;
\end{DoxyCode}


Start and end Y-\/locations are achieved by multiplying the view Y-\/range with {\ttfamily startY} and {\ttfamily endY} factors: 
\begin{DoxyCode}
 startY *= gameViewRangeY;
 endY *= gameViewRangeY;
\end{DoxyCode}


Vertical start direction is calculated accordingly.

Direction vector is scaled into an unit vector and start angle is calculated according to direction unit vector.


\begin{DoxyParams}{Parameters}
\item[{\em mode}]One of the modes defined with enumeration \hyperlink{gameengine_8h_a622f68cdaded1ddf85ccecb9cfed089f}{GameObjectStartMode}. \item[{\em marginRelative}]Relative margin for calculating location for game object. Margin values $>$ 1.0 (e.g. 1.15) are used for computing off-\/screen position for the game object.\item[\mbox{\tt[out]} {\em startParameters}]Structure for storing game object start parameters. \end{DoxyParams}
\hypertarget{class_game_engine_a75fab1676bacd8c49529269e0acfec61}{
\index{GameEngine@{GameEngine}!handleAsteroidSplitting@{handleAsteroidSplitting}}
\index{handleAsteroidSplitting@{handleAsteroidSplitting}!GameEngine@{GameEngine}}
\subsubsection[{handleAsteroidSplitting}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::handleAsteroidSplitting (
\begin{DoxyParamCaption}
\item[{int}]{ asteroidIndex}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a75fab1676bacd8c49529269e0acfec61}


Replaces a large asteroid with medium sized asteroids and a medium sized asteroid with mineral collectible. 

When creating medium sized asteroids, the asteoids are appended into a ''collision group''. Items in collision group are protected for collisions to each other for time defined in {\ttfamily \hyperlink{class_game_object_a3effe25d7be75935ce5170e33c00ab4f}{GameObject::collisionFreeFrames}}.

Increments progress value and score. Creates also randomly bomb collectibles if bomb collectibles are left for current level. The replaced object is set in ''dead'' state waiting for possible rewind mode playback.


\begin{DoxyParams}{Parameters}
\item[{\em asteroidIndex}]The index of collided asteroid in an asteroid list. \end{DoxyParams}
\hypertarget{class_game_engine_aba7429045bf334f3c81b423a3279dc7d}{
\index{GameEngine@{GameEngine}!handleBumpCollision@{handleBumpCollision}}
\index{handleBumpCollision@{handleBumpCollision}!GameEngine@{GameEngine}}
\subsubsection[{handleBumpCollision}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::handleBumpCollision (
\begin{DoxyParamCaption}
\item[{{\bf GameObject} $\ast$}]{ gameObjectA, }
\item[{{\bf GameObject} $\ast$}]{ gameObjectB}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_aba7429045bf334f3c81b423a3279dc7d}


Creates a ''bump''-\/collision effect between two colliding game objects A and B. 

In a ''bump''-\/collision an inelastic collision (like two steel balls hitting together) is imitated. The momentums of the objects are exchanged, while the sum of all velocities is maintained.

First total velocities of objects are calculated. The total velocity is calculated using the Pythagorean theorem $c = \sqrt{a^2 + b^2}$ , e.g. for calculating the total velocity for object A: 
\begin{DoxyCode}
 totalVelocityA = sqrt(gameObjectA->velX() * gameObjectA->velX() + gameObjectA->v
      elY() * gameObjectA->velY());
\end{DoxyCode}


If the total velocities of A and B are too small the inelastic collision model fails. A minimal total velocity is assigned for game objects.

Collision vector and collision vector length is calculated from positions of A and B: 
\begin{DoxyCode}
 collisionVectorX = gameObjectB->posX() - gameObjectA->posX();
 collisionVectorY = gameObjectB->posY() - gameObjectA->posY();
 collisionVectorLength = sqrt(collisionVectorX * collisionVectorX + collisionVect
      orY * collisionVectorY);
\end{DoxyCode}


If the collision vector length is near zero, a new randomized collision vector is created to prevent possible risk of zero division: 
\begin{DoxyCode}
 collisionVectorX = getRandomF() - 0.50f;
 collisionVectorY = getRandomF() - 0.50f;
 collisionVectorLength = sqrt(collisionVectorX * collisionVectorX + collisionVect
      orY * collisionVectorY);
\end{DoxyCode}


Collision vector is calculated to a unit vector: 
\begin{DoxyCode}
 collisionVectorX /= collisionVectorLength;
 collisionVectorY /= collisionVectorLength;
\end{DoxyCode}


Each game object has a mass value. A momentum impact is appended on velocities as based on conservation of momentum as in

$m_1v_1 + m_2v_2 = m_1v_1' + m_2v_2'$

and conservation of kinetic energy as in

$m_1v_1^2 + m_2v_2^2 = m_1v_1'^2 + m_2v_2'^2$

Final velocities are calculated as in

$v_1' = (2m_2v_2 + v_1(m_1-m_2))/(m_1+m_2)$

$v_2' = (2m_2v_1 + v_2(m_1-m_2))/(m_1+m_2)$


\begin{DoxyCode}
 massA = gameObjectA->mass();
 massB = gameObjectB->mass();
 finalTotalVelocityA = (2.0f * massB * totalVelocityB + totalVelocityA * (massA -
       massB)) / (massA + massB);
 finalTotalVelocityB = (2.0f * massA * totalVelocityA + totalVelocityB * (massB -
       massA)) / (massA + massB);
\end{DoxyCode}


New velocities are set into the game objects with collision vector to opposite directions: 
\begin{DoxyCode}
 gameObjectA->setVelX(-collisionVectorX * finalTotalVelocityA);
 gameObjectA->setVelY(-collisionVectorY * finalTotalVelocityA);
 gameObjectB->setVelX(+collisionVectorX * finalTotalVelocityB);
 gameObjectB->setVelY(+collisionVectorY * finalTotalVelocityB);
\end{DoxyCode}
 \hypertarget{class_game_engine_a1b776db2514918c20a36018fc29497cc}{
\index{GameEngine@{GameEngine}!handleGameTimers@{handleGameTimers}}
\index{handleGameTimers@{handleGameTimers}!GameEngine@{GameEngine}}
\subsubsection[{handleGameTimers}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::handleGameTimers (
\begin{DoxyParamCaption}
\item[{FPtype}]{ timestep}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a1b776db2514918c20a36018fc29497cc}


Updates game timers and takes actions according to timer states. 

In rewind mode playback, {\ttfamily \hyperlink{class_game_widget_a2d2dc0fadc2be24e5bda61958cf85aa9}{GameWidget::cycleRewindMode()}} is an equivalent to this method, but it only does a selected set of tasks so that effects and animations are played but the game state is not altered and the game can go on right after the playback has stopped.


\begin{DoxyParams}{Parameters}
\item[{\em timestep}]A timestep in milliseconds (calculated frame length). \end{DoxyParams}
\hypertarget{class_game_engine_a80076a8cc8c78b4401cc4c0f92fcd07e}{
\index{GameEngine@{GameEngine}!handleMinerAsteroidCollision@{handleMinerAsteroidCollision}}
\index{handleMinerAsteroidCollision@{handleMinerAsteroidCollision}!GameEngine@{GameEngine}}
\subsubsection[{handleMinerAsteroidCollision}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::handleMinerAsteroidCollision (
\begin{DoxyParamCaption}
\item[{int}]{ asteroidIndex}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a80076a8cc8c78b4401cc4c0f92fcd07e}


Handles a miner to asteroid collision. 

If miner is in ball mode, a collision handler for ''bump''-\/effect is called ({\ttfamily \hyperlink{class_game_engine_aba7429045bf334f3c81b423a3279dc7d}{GameEngine::handleBumpCollision()}}) and the asteroid is split (\hyperlink{class_game_engine_a75fab1676bacd8c49529269e0acfec61}{GameEngine::handleAsteroidSplitting()}).

If miner is in cone mode and is not protected a player crash handler is called ({\ttfamily \hyperlink{class_game_engine_aa9111a6e3ccd429d86414c9aa3ccb6c3}{handlePlayerCrash()}}). If player is protected and a hyper jump timer is not running a ''bump'' collision occurs.


\begin{DoxyParams}{Parameters}
\item[{\em asteroidIndex}]The index of collided asteroid in an asteroid list. \end{DoxyParams}
\hypertarget{class_game_engine_a4a3c43561e4bf844c70e7d5889b45c95}{
\index{GameEngine@{GameEngine}!handleMinerCollectibleCollision@{handleMinerCollectibleCollision}}
\index{handleMinerCollectibleCollision@{handleMinerCollectibleCollision}!GameEngine@{GameEngine}}
\subsubsection[{handleMinerCollectibleCollision}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::handleMinerCollectibleCollision (
\begin{DoxyParamCaption}
\item[{int}]{ collectibleIndex}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a4a3c43561e4bf844c70e7d5889b45c95}


Handles a collision between the miner and a collectible. 

The collectible specific counter is increased for bombs and hyper jump collectibles (hyper jumps are not currently collectibles but could be easily enabled as ones). Collecting minerals increase the {\ttfamily currentLevelProgress} counter:


\begin{DoxyCode}
 switch (col->objectType()) {
    case TypeCollectibleMineralA:   // fall through
    case TypeCollectibleMineralB:   // fall through
    case TypeCollectibleMineralC:   // fall through
    case TypeCollectibleMineralD:
        currentLevelProgress[0] += ProgressOther;
        break;
    // ...
 }
\end{DoxyCode}


Sound effect is played, score is increased according to collectible's score value and the collectible object is set into ''dead'' state for possible rewind mode playback.


\begin{DoxyParams}{Parameters}
\item[{\em collectibleIndex}]The index of collided collectible in an {\ttfamily collectibleList}. \end{DoxyParams}
\hypertarget{class_game_engine_aa9111a6e3ccd429d86414c9aa3ccb6c3}{
\index{GameEngine@{GameEngine}!handlePlayerCrash@{handlePlayerCrash}}
\index{handlePlayerCrash@{handlePlayerCrash}!GameEngine@{GameEngine}}
\subsubsection[{handlePlayerCrash}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::handlePlayerCrash (
\begin{DoxyParamCaption}
\item[{const {\bf SoundEffectType}}]{ type}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_aa9111a6e3ccd429d86414c9aa3ccb6c3}


Handles a ''miner crashed''-\/event. 


\begin{DoxyParams}{Parameters}
\item[{\em type}]Sound effect type (one of the SoundEffectType enumeration values). \end{DoxyParams}
\hypertarget{class_game_engine_a057552def06970150d25252715261c4e}{
\index{GameEngine@{GameEngine}!handlePlayerDies@{handlePlayerDies}}
\index{handlePlayerDies@{handlePlayerDies}!GameEngine@{GameEngine}}
\subsubsection[{handlePlayerDies}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::handlePlayerDies (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a057552def06970150d25252715261c4e}


Handles a ''miner died''-\/event. 

Miner is set into a ''dead'' state. The {\ttfamily minersLeft} count is decremented. All the miner related effects currently running are terminated and the ''Player crashed'' timer is started ({\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548a7da1b8fc163d73e620385de45e3980a5}{GameTimer::statePlayerCrashedTimer}}). \hypertarget{class_game_engine_ae936fa53b2e5a145864bebc0a9d6598e}{
\index{GameEngine@{GameEngine}!initializeFrame@{initializeFrame}}
\index{initializeFrame@{initializeFrame}!GameEngine@{GameEngine}}
\subsubsection[{initializeFrame}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::initializeFrame (
\begin{DoxyParamCaption}
\item[{FPtype}]{ timestep}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_ae936fa53b2e5a145864bebc0a9d6598e}


Initializes a new {\ttfamily \hyperlink{class_frame_info}{FrameInfo}} object for rewind mode. 

{\ttfamily \hyperlink{class_frame_info}{FrameInfo}} objects are stored in the {\ttfamily frameInfoQ} queue for rewind mode for each game frame. Initializes and queues a new {\ttfamily \hyperlink{class_frame_info}{FrameInfo}} object and purges the obsoleted {\ttfamily \hyperlink{class_frame_info}{FrameInfo}} objects to keep the queue size reasonable. Keeps up the total frame count and total time. The given timestep is appended to total time.


\begin{DoxyParams}{Parameters}
\item[{\em timestep}]A timestep in milliseconds (calculated frame length). \end{DoxyParams}
\hypertarget{class_game_engine_a45c977471781cf798b62c8e8fd4aa200}{
\index{GameEngine@{GameEngine}!initNewGame@{initNewGame}}
\index{initNewGame@{initNewGame}!GameEngine@{GameEngine}}
\subsubsection[{initNewGame}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::initNewGame (
\begin{DoxyParamCaption}
\item[{bool}]{ rewind, }
\item[{int}]{ difficultyLevel}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a45c977471781cf798b62c8e8fd4aa200}


Initializes a new game. 

Cleans up possible existing old game objects. Initializes the game variables, creates a new miner object, initalizes a new {\ttfamily \hyperlink{class_game_level}{GameLevel}} object. Initializes the particle buffer, starts the \char`\"{}Get Ready\char`\"{}-\/timer for starting the gameplay. The timer will not proceed until the game loop is called.


\begin{DoxyParams}{Parameters}
\item[{\em rewind}]True if rewind mode is enabled \item[{\em difficultyLevel}]Difficulty level of the game from settings (1 = Easy, 2 = Normal, 3 = Hard) \end{DoxyParams}
\hypertarget{class_game_engine_acd585297a9283fd6567744c82d8133cc}{
\index{GameEngine@{GameEngine}!initNextLevel@{initNextLevel}}
\index{initNextLevel@{initNextLevel}!GameEngine@{GameEngine}}
\subsubsection[{initNextLevel}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::initNextLevel (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_acd585297a9283fd6567744c82d8133cc}


Initializes the level data. 

Calls the {\ttfamily \hyperlink{class_game_level}{GameLevel}} instance to write the level data for the next level to {\ttfamily levelData}. Manage the trigger lists for triggering new game objects at radomly selected level progress points, e.g. 
\begin{DoxyCode}
 for (int i=0;i < levelData.ufos;i++)
     triggerUfo.append(rand() % maxProgress);
 qSort(triggerUfo.begin(), triggerUfo.end(), initNextLevelMoreThan);
\end{DoxyCode}
 \hypertarget{class_game_engine_a4ed01c2a0d4aefefff8ea4ec213ddcb4}{
\index{GameEngine@{GameEngine}!initObjectsForRewindMode@{initObjectsForRewindMode}}
\index{initObjectsForRewindMode@{initObjectsForRewindMode}!GameEngine@{GameEngine}}
\subsubsection[{initObjectsForRewindMode}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::initObjectsForRewindMode (
\begin{DoxyParamCaption}
\item[{int}]{ firstFrame}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a4ed01c2a0d4aefefff8ea4ec213ddcb4}


Initialize game objects for the rewind mode playback. 

The {\ttfamily \hyperlink{class_game_object_a3b4d73a49afdbbc42b4f488c93594aad}{GameObject::initRewindMode()}} method is called for each game object to set the read index for rewind mode data.

The rotation angle for asteroids and direction for missiles are also initialized.

The particle effects are also initialized by setting the initial position and velocity values.

\hyperlink{struct_particle}{Particle} buffer reading positions are computed and set for each frame.

Sets the stored ship mode for given rewind mode playback start frame.


\begin{DoxyParams}{Parameters}
\item[{\em firstFrame}]The starting frame for the rewind mode playback. \end{DoxyParams}
\hypertarget{class_game_engine_a66036f5a81212b0cc98726f0df8ff270}{
\index{GameEngine@{GameEngine}!integrateMotion@{integrateMotion}}
\index{integrateMotion@{integrateMotion}!GameEngine@{GameEngine}}
\subsubsection[{integrateMotion}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::integrateMotion (
\begin{DoxyParamCaption}
\item[{{\bf GameObject} $\ast$}]{ gameObject, }
\item[{FPtype}]{ timestep}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a66036f5a81212b0cc98726f0df8ff270}


Integrates movement to a game object according to given time step. 

Game object's current location is appended with a product of game object's velocity, timestep and a scale factor. 
\begin{DoxyCode}
 gameObject->setPosX(gameObject->posX() + gameObject->velX() * timestep * x);
 gameObject->setPosY(gameObject->posY() + gameObject->velY() * timestep * x);
\end{DoxyCode}


The value x is an integration constant which determines how strongly the object velocities change the object positions.


\begin{DoxyParams}{Parameters}
\item[{\em gameObject}]A game object to integrate movement to \item[{\em timestep}]A timestep in milliseconds (calculated frame length). \end{DoxyParams}
\hypertarget{class_game_engine_aa4469b8ac4ade3f21c74e3f131aec4c2}{
\index{GameEngine@{GameEngine}!isOffScreen@{isOffScreen}}
\index{isOffScreen@{isOffScreen}!GameEngine@{GameEngine}}
\subsubsection[{isOffScreen}]{\setlength{\rightskip}{0pt plus 5cm}bool GameEngine::isOffScreen (
\begin{DoxyParamCaption}
\item[{{\bf GameObject} $\ast$}]{ gameObject, }
\item[{FPtype $\ast$}]{ margins}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_aa4469b8ac4ade3f21c74e3f131aec4c2}


Checks if the given game object's current location is off-\/screen. 

The current location is compared to {\ttfamily gameViewRangeX} and {\ttfamily gameViewRangeY} with given margin settings.


\begin{DoxyParams}{Parameters}
\item[{\em gameObject}]Game object being checked. \item[{\em margins}]An array with x-\/margin value in index 0 and y-\/margin value in index 1.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
True if game object is off-\/screen. 
\end{DoxyReturn}
\hypertarget{class_game_engine_aab271f38a27b694cc73fc0122d856989}{
\index{GameEngine@{GameEngine}!isPlayerProtected@{isPlayerProtected}}
\index{isPlayerProtected@{isPlayerProtected}!GameEngine@{GameEngine}}
\subsubsection[{isPlayerProtected}]{\setlength{\rightskip}{0pt plus 5cm}bool GameEngine::isPlayerProtected (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_aab271f38a27b694cc73fc0122d856989}


Checks if the miner is in protected state. 

Miner is in protected state if one of the following timers is running:
\begin{DoxyItemize}
\item {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548ad1f8e4fd830fe397eeb3bf16bd30187f}{GameTimer::shipSafeTimer}} 
\item {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548a4b5a3e67d50f7d5c705a6bb5b37d209b}{GameTimer::hyperJumpOutTimer}} 
\item {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548a35916514b126679567f57396c732c315}{GameTimer::hyperJumpInTimer}} 
\item {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548afab4541f520311a3a67010c7c66be9e9}{GameTimer::stateGetReadyTimer}} 
\item {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548a7b843da3fffbf65897071c53c487156c}{GameTimer::stateLevelChangingTimer}} 
\end{DoxyItemize}

\begin{DoxyReturn}{Returns}
True if miner is in protected state. 
\end{DoxyReturn}
\hypertarget{class_game_engine_a9bfe18fe519da69bbd7077d7d4efd817}{
\index{GameEngine@{GameEngine}!isUnnecessary@{isUnnecessary}}
\index{isUnnecessary@{isUnnecessary}!GameEngine@{GameEngine}}
\subsubsection[{isUnnecessary}]{\setlength{\rightskip}{0pt plus 5cm}bool GameEngine::isUnnecessary (
\begin{DoxyParamCaption}
\item[{{\bf GameObject} $\ast$}]{ gameObject}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a9bfe18fe519da69bbd7077d7d4efd817}


Checks if given object is expired: it's no longer ''alive'' and it's no longer needed for the rewind mode playback. 

To check if object is needed for the rewind mode playback, the difference from current time and the time object was set to ''dead'' state is compared to \hyperlink{defines_8h_a4d5bbb5ac260312a8cee6df45f8fe242}{SMASHMINER\_\-CONFIG\_\-REWIND\_\-PERIOD\_\-SECONDS}.


\begin{DoxyCode}
 if (totalTimeCounter - gameObject->diedTime() > SMASHMINER_CONFIG_REWIND_PERIOD_
      SECONDS)
      return true;
\end{DoxyCode}



\begin{DoxyParams}{Parameters}
\item[{\em gameObject}]Game object being checked if it's no longer needed. \end{DoxyParams}
\begin{DoxyReturn}{Returns}
True if the given game object is no longer needed and can be cleaned up. 
\end{DoxyReturn}
\hypertarget{class_game_engine_a9c68acd3f416ff54a494c2f85edfea26}{
\index{GameEngine@{GameEngine}!launchBomb@{launchBomb}}
\index{launchBomb@{launchBomb}!GameEngine@{GameEngine}}
\subsubsection[{launchBomb}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::launchBomb (
\begin{DoxyParamCaption}
\item[{FPtype}]{ posX, }
\item[{FPtype}]{ posY}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a9c68acd3f416ff54a494c2f85edfea26}


Creates a bomb effect starting from given location. 

Creates a new {\ttfamily \hyperlink{class_bomb_effect}{BombEffect}} instance to give location and appends it to the list of new effects. \hyperlink{class_bomb}{Bomb} count is decremented and a sound effect will also be appended.


\begin{DoxyParams}{Parameters}
\item[{\em posX}]X-\/coordinate of the bomb effect. \item[{\em posY}]Y-\/coordinate of the bomb effect. \end{DoxyParams}
\hypertarget{class_game_engine_a8cc6c528eed39526cc16b082f365f484}{
\index{GameEngine@{GameEngine}!launchBombSelf@{launchBombSelf}}
\index{launchBombSelf@{launchBombSelf}!GameEngine@{GameEngine}}
\subsubsection[{launchBombSelf}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::launchBombSelf (
\begin{DoxyParamCaption}
\item[{FPtype}]{ posX, }
\item[{FPtype}]{ posY}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a8cc6c528eed39526cc16b082f365f484}


Creates a bomb self explosion effect. 

If bomb is not collected during it's lifecycle it will explode. If miner is too close to explosion it will also explode.

A particle explosion effect is created ({\ttfamily \hyperlink{class_game_engine_a273d097954b98d80ba7d829ddab11417}{GameEngine::createParticleExplosion()}}). The distance between miner and bomb location is calculated and if the distace is under the set deadly distance the player will crash ({\ttfamily \hyperlink{class_game_engine_aa9111a6e3ccd429d86414c9aa3ccb6c3}{GameEngine::handlePlayerCrash()}}).


\begin{DoxyParams}{Parameters}
\item[{\em posX}]The bomb X-\/location. \item[{\em posY}]The bomb Y-\/location. \end{DoxyParams}
\hypertarget{class_game_engine_a385a685ce0e33310f6d943d1850c1398}{
\index{GameEngine@{GameEngine}!moreGameObjects@{moreGameObjects}}
\index{moreGameObjects@{moreGameObjects}!GameEngine@{GameEngine}}
\subsubsection[{moreGameObjects}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::moreGameObjects (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a385a685ce0e33310f6d943d1850c1398}


Populates game level with new game objects. 

If the game objectives for current level are not already filled, new game objects may be appended to game. Game level objectives are tested with {\ttfamily \hyperlink{class_game_engine_a2a240907bf5b16ae848cf400de404d9d}{GameEngine::objectivesFilled()}}.

The game timer identified with {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548a2344c1052c9436187ccd7b1a159828b8}{GameTimer::moreObjectsTimer}} regulates when new objects are appended to game level. When the timer has full time new game objects may be added and the timer is restarted.


\begin{DoxyCode}
 if (!timerManager->isFullTime(GameTimer::moreObjectsTimer))
      return;
 timerManager->startGameTimer(GameTimer::moreObjectsTimer);
\end{DoxyCode}


Each level has maximum amount of game objects in screen stored in {\ttfamily levelData} ({\ttfamily \hyperlink{struct_game_level_data_a54279b28d5d1ae78ad28472c23603978}{GameLevelData::maxObjectsInScreen}}). {\ttfamily levelData} has also the remaining amount of each game object for current level, e.g. {\ttfamily levelData.asteroids}.

{\ttfamily currentObjects} constains the amount of current game objects on screen and {\ttfamily potentialObjects} contains the potential amount of game objects resulting from current objects. These values are calculated while checking if the game objectives are already filled with {\ttfamily \hyperlink{class_game_engine_a2a240907bf5b16ae848cf400de404d9d}{GameEngine::objectivesFilled()}}.

A game object of type T is added to screen if game objects of type T are remaining for current level and if the potential game objects resulting from game object of type T does not pass maximum amount of objects in screen defined for current level.

Also the current level progress is checked (If the game object is other than asteroid). The game objects are triggered to screen on randomly selected progress points. The trigger points are set in {\ttfamily \hyperlink{class_game_engine_acd585297a9283fd6567744c82d8133cc}{GameEngine::initNextLevel()}} when initializing a new level.

Array {\ttfamily GameEngine::currentLevelProgress} contains the current level progress value in index 0 and the maximum progress value in index 1. The maximum progress value for level is counted in {\ttfamily \hyperlink{class_game_level_a89cc3c5955eb9966e8c8ef6c7e4a629c}{GameLevel::nextLevel()}}.


\begin{DoxyCode}
 if (levelData.ufos > 0 && potentialObjects + objectValue <= levelData.
      maxObjectsInScreen
     && currentLevelProgress[0] >= triggerUfo.at(levelData.ufos - 1)) {
      levelData.ufos--;
      currentObjects++;
      potentialObjects += objectValue;
      // ...
      Ufo *u = new Ufo(totalFrameCounter, rewindEnabled, Ufo::SineMovement, sp.an
      gle);
      // ...
      enemyList.append(u);
  }
\end{DoxyCode}


After adding a new game object the currentObjects count is increased and the potentialObjects value is appended with the amount of potential objects resulting from object of type T (as defined in enumeration {\ttfamily PotentialObjects}). An object of type T is instantiated and added to game. \hypertarget{class_game_engine_aab41e253c31468827fb83e6b333a42f2}{
\index{GameEngine@{GameEngine}!newSoundEffect@{newSoundEffect}}
\index{newSoundEffect@{newSoundEffect}!GameEngine@{GameEngine}}
\subsubsection[{newSoundEffect}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::newSoundEffect (
\begin{DoxyParamCaption}
\item[{{\bf SoundEffectType}}]{ effectType}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_aab41e253c31468827fb83e6b333a42f2}


Creates a new sound effect of given type and appends it to the list of new effects. 


\begin{DoxyParams}{Parameters}
\item[{\em effectType}]One of the sound effect types defined with enumeration {\ttfamily \hyperlink{soundengine_8h_a608db89860fa5723001cc530622ba5bf}{SoundEffectType}}. \end{DoxyParams}
\hypertarget{class_game_engine_a3f48272ecfd570f8ca590873c5a9cb01}{
\index{GameEngine@{GameEngine}!normalizeVect3D\_\-GLfloat@{normalizeVect3D\_\-GLfloat}}
\index{normalizeVect3D\_\-GLfloat@{normalizeVect3D\_\-GLfloat}!GameEngine@{GameEngine}}
\subsubsection[{normalizeVect3D\_\-GLfloat}]{\setlength{\rightskip}{0pt plus 5cm}static void GameEngine::normalizeVect3D\_\-GLfloat (
\begin{DoxyParamCaption}
\item[{GLfloat $\ast$}]{ vect}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, static\mbox{]}}}}
\label{class_game_engine_a3f48272ecfd570f8ca590873c5a9cb01}


Normalized a give 3-\/component vector. 


\begin{DoxyParams}{Parameters}
\item[{\em vect}]An array presenting a 3-\/component vector. \end{DoxyParams}
\hypertarget{class_game_engine_a2a240907bf5b16ae848cf400de404d9d}{
\index{GameEngine@{GameEngine}!objectivesFilled@{objectivesFilled}}
\index{objectivesFilled@{objectivesFilled}!GameEngine@{GameEngine}}
\subsubsection[{objectivesFilled}]{\setlength{\rightskip}{0pt plus 5cm}bool GameEngine::objectivesFilled (
\begin{DoxyParamCaption}
\item[{int \&}]{ currentObjects, }
\item[{int \&}]{ potentialObjects}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a2a240907bf5b16ae848cf400de404d9d}


Checks if the objectives for current level are fulfilled. 

The game objects in screen will be counted and the potential game object count is measured according to existing game objects.

The game level objectives are fulfilled if miner is alive, there's no game objects in screen and all remaining asteroids for level is 0. If the objectives are fulfilled, the timer for changing to a new level is started ({\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548a7b843da3fffbf65897071c53c487156c}{GameTimer::stateLevelChangingTimer}}).


\begin{DoxyParams}{Parameters}
\item[{\em currentObjects}]To store the current objects in screen count \item[{\em potentialObjects}]To store the potential objects in screen count reflecting from current game objects in screen\end{DoxyParams}
\begin{DoxyReturn}{Returns}
True if all the objectives for the level are fulfilled. 
\end{DoxyReturn}
\hypertarget{class_game_engine_a4082ada6ed021d5dbc87bac033d4a70b}{
\index{GameEngine@{GameEngine}!processNewEffects@{processNewEffects}}
\index{processNewEffects@{processNewEffects}!GameEngine@{GameEngine}}
\subsubsection[{processNewEffects}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::processNewEffects (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a4082ada6ed021d5dbc87bac033d4a70b}


Processes game effects stored in a list of new effects during the last game frame. 

During each game loop cycle the new effects are stored in the {\ttfamily newEffects} list. In the end of game loop cycle the effects are played using {\ttfamily \hyperlink{class_game_engine_a4082ada6ed021d5dbc87bac033d4a70b}{GameEngine::processNewEffects()}}.

If rewind mode is enabled the played effects are queued into {\ttfamily pastEffects} queue for rewind mode playback. Expired effects are cleaned up from the {\ttfamily pastEffects} queue. \hypertarget{class_game_engine_ad1ec13623508f3c942d8730f0e8e58bd}{
\index{GameEngine@{GameEngine}!removeUnnecessaryObjects@{removeUnnecessaryObjects}}
\index{removeUnnecessaryObjects@{removeUnnecessaryObjects}!GameEngine@{GameEngine}}
\subsubsection[{removeUnnecessaryObjects}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::removeUnnecessaryObjects (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_ad1ec13623508f3c942d8730f0e8e58bd}


Cleans up expired game objects. 

The {\ttfamily \hyperlink{class_game_engine_a9bfe18fe519da69bbd7077d7d4efd817}{GameEngine::isUnnecessary()}} checks if an object is not needed anymore for game play or rewind mode playback. Expired asteroids, collectibles and enemies will be removed from object lists and deleted.

Sets also off-\/screen ({\ttfamily \hyperlink{class_game_engine_aa4469b8ac4ade3f21c74e3f131aec4c2}{GameEngine::isOffScreen()}}) non-\/wrapping game objects (comets, meteor showers and black holes) to ''dead'' state to wait for rewind mode playback and delete them when they are not needed for rewind mode playback. \hypertarget{class_game_engine_a5b2cfc83c45aef838a19773539abe72e}{
\index{GameEngine@{GameEngine}!resetSpaceShip@{resetSpaceShip}}
\index{resetSpaceShip@{resetSpaceShip}!GameEngine@{GameEngine}}
\subsubsection[{resetSpaceShip}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::resetSpaceShip (
\begin{DoxyParamCaption}
\item[{FPtype}]{ positionX, }
\item[{FPtype}]{ positionY}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a5b2cfc83c45aef838a19773539abe72e}


Resets the miner to given location. 

The ship mode is set to ''Ball'' mode and the member variables are reset.


\begin{DoxyParams}{Parameters}
\item[{\em positionX}]X-\/coordinate for miner location. \item[{\em positionY}]Y-\/coordinate for miner location. \end{DoxyParams}
\hypertarget{class_game_engine_a76ec2b4e6eac127a00db7d331f933571}{
\index{GameEngine@{GameEngine}!resetTimersForRewindMode@{resetTimersForRewindMode}}
\index{resetTimersForRewindMode@{resetTimersForRewindMode}!GameEngine@{GameEngine}}
\subsubsection[{resetTimersForRewindMode}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::resetTimersForRewindMode (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a76ec2b4e6eac127a00db7d331f933571}


Reset timers for the rewind mode playback. 

Stops hyper jump timers and cleans up static hyper jump data from {\ttfamily \hyperlink{class_timer_manager}{TimerManager}}. Hyper jump effects should not be running when rewind mode is set since miner should be protected during hyper jump effects and rewind mode is called when miner dies. \hypertarget{class_game_engine_ad0854767b6f866ef7fa14b7c1c95178d}{
\index{GameEngine@{GameEngine}!score@{score}}
\index{score@{score}!GameEngine@{GameEngine}}
\subsubsection[{score}]{\setlength{\rightskip}{0pt plus 5cm}QList$<$ int $>$ GameEngine::score (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_ad0854767b6f866ef7fa14b7c1c95178d}


Updates the score digits according to game score. 

\begin{DoxyReturn}{Returns}
QList of score digits as integers. 
\end{DoxyReturn}
\hypertarget{class_game_engine_a567ce43ede37728459313242a47c04c9}{
\index{GameEngine@{GameEngine}!setObjectDead@{setObjectDead}}
\index{setObjectDead@{setObjectDead}!GameEngine@{GameEngine}}
\subsubsection[{setObjectDead}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::setObjectDead (
\begin{DoxyParamCaption}
\item[{{\bf GameObject} $\ast$}]{ gameObject, }
\item[{int}]{ frame, }
\item[{FPtype}]{ time}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a567ce43ede37728459313242a47c04c9}


Set object to ''dead'' state waiting for the possible rewind playback. 

Note : we may NOT delete objects here since we need them in the rewind mode after setting object dead!


\begin{DoxyParams}{Parameters}
\item[{\em gameObject}]game object being set to ''dead'' state \item[{\em frame}]Current frame as in totalFrameCounter to be stored for the rewind playback \item[{\em time}]game time as in totalTimeCounter \end{DoxyParams}
\hypertarget{class_game_engine_afe8540c2b25afc331b3d92d8f9ec3842}{
\index{GameEngine@{GameEngine}!setShakeZ@{setShakeZ}}
\index{setShakeZ@{setShakeZ}!GameEngine@{GameEngine}}
\subsubsection[{setShakeZ}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::setShakeZ (
\begin{DoxyParamCaption}
\item[{FPtype}]{ shakeZ}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_afe8540c2b25afc331b3d92d8f9ec3842}


Sets the ''shake'' value according for hyper jump control. 

''Shake'' value is measured using accelerator sensor.


\begin{DoxyParams}{Parameters}
\item[{\em shakeZ}]''Shake'' value from accelerator sensor. \end{DoxyParams}
\hypertarget{class_game_engine_ad6aabc5c0d4417fa083d94f6847257de}{
\index{GameEngine@{GameEngine}!setShipModeImmediate@{setShipModeImmediate}}
\index{setShipModeImmediate@{setShipModeImmediate}!GameEngine@{GameEngine}}
\subsubsection[{setShipModeImmediate}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::setShipModeImmediate (
\begin{DoxyParamCaption}
\item[{{\bf SpaceCraftMode}}]{ newMode}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_ad6aabc5c0d4417fa083d94f6847257de}


Changes the ship mode instantly into give mode withoud animation delay. 

Stop the possibly running ship mode timer. Set the ship mode to give mode. Request immidiate update on ship graphics by setting {\ttfamily updateSpaceShipGraphics} to true.


\begin{DoxyParams}{Parameters}
\item[{\em newMode}]The ship mode for miner \end{DoxyParams}
\hypertarget{class_game_engine_a8f01ae49252f09ef41aa02b5fd5bca76}{
\index{GameEngine@{GameEngine}!setSoundEngine@{setSoundEngine}}
\index{setSoundEngine@{setSoundEngine}!GameEngine@{GameEngine}}
\subsubsection[{setSoundEngine}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::setSoundEngine (
\begin{DoxyParamCaption}
\item[{{\bf SoundEngine} $\ast$}]{ engine}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}inline, private\mbox{]}}}}
\label{class_game_engine_a8f01ae49252f09ef41aa02b5fd5bca76}


Sets the sound engine. 


\begin{DoxyParams}{Parameters}
\item[{\em engine}]pointer to a \hyperlink{class_sound_engine}{SoundEngine} instance \end{DoxyParams}
\hypertarget{class_game_engine_a7ba1fb61770758f4d551bfdc0243fc05}{
\index{GameEngine@{GameEngine}!setSteeringX@{setSteeringX}}
\index{setSteeringX@{setSteeringX}!GameEngine@{GameEngine}}
\subsubsection[{setSteeringX}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::setSteeringX (
\begin{DoxyParamCaption}
\item[{FPtype}]{ steeringX}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a7ba1fb61770758f4d551bfdc0243fc05}


Sets the miner control X-\/coordinate steering value. 

Steering value is measured using rotation sensor. Limits also the steering values to range \mbox{[}-\/1,+1\mbox{]}.


\begin{DoxyParams}{Parameters}
\item[{\em steeringX}]X-\/axel steering value from rotation sensor. \end{DoxyParams}
\hypertarget{class_game_engine_a60240c9dd57fa230a257d1d70c38dd45}{
\index{GameEngine@{GameEngine}!setSteeringY@{setSteeringY}}
\index{setSteeringY@{setSteeringY}!GameEngine@{GameEngine}}
\subsubsection[{setSteeringY}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::setSteeringY (
\begin{DoxyParamCaption}
\item[{FPtype}]{ steeringY}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a60240c9dd57fa230a257d1d70c38dd45}


Sets the miner control Y-\/coordinate steering value. 

Steering value is measured using rotation sensor. Limits also the steering values to range \mbox{[}-\/1,+1\mbox{]}.


\begin{DoxyParams}{Parameters}
\item[{\em steeringY}]Y-\/axel steering value from rotation sensor. \end{DoxyParams}
\hypertarget{class_game_engine_a0d99b70c324e2ffa798a91fdc1e069d8}{
\index{GameEngine@{GameEngine}!shipHyperJumpIn@{shipHyperJumpIn}}
\index{shipHyperJumpIn@{shipHyperJumpIn}!GameEngine@{GameEngine}}
\subsubsection[{shipHyperJumpIn}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::shipHyperJumpIn (
\begin{DoxyParamCaption}
\item[{bool}]{ needSpaceShipReset}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a0d99b70c324e2ffa798a91fdc1e069d8}


Creates a hyper jump-\/in effect for miner space ship. 

Hyper jump-\/in effect is used to bring the miner back to screen from hyper jump. {\ttfamily \hyperlink{class_hyper_jump_navigator}{HyperJumpNavigator}} instance and {\ttfamily \hyperlink{class_timer_manager_a3196dd09336613c936f3936d759363f2}{TimerManager::hyperJumpInData}} should be available -\/-\/-\/ if not, a recovery will be made and method is leaved. Gets a location for miner and {\ttfamily \hyperlink{class_hyper_jump_in_effect}{HyperJumpInEffect}} from the {\ttfamily \hyperlink{class_hyper_jump_navigator}{HyperJumpNavigator}} instance. A new {\ttfamily \hyperlink{class_hyper_jump_in_effect}{HyperJumpInEffect}} effect instance is created and appended to the list of new effects ({\ttfamily newEffects}). A reset can be requested for the miner space ship ({\ttfamily \hyperlink{class_game_engine_a5b2cfc83c45aef838a19773539abe72e}{GameEngine::resetSpaceShip()}}).


\begin{DoxyParams}{Parameters}
\item[{\em needSpaceShipReset}]Set to true to request a reset for the miner space ship. \end{DoxyParams}
\hypertarget{class_game_engine_ab64d40c6c1e38769121602bf0936a371}{
\index{GameEngine@{GameEngine}!shipHyperJumpOut@{shipHyperJumpOut}}
\index{shipHyperJumpOut@{shipHyperJumpOut}!GameEngine@{GameEngine}}
\subsubsection[{shipHyperJumpOut}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::shipHyperJumpOut (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_ab64d40c6c1e38769121602bf0936a371}


Creates a hyper jump-\/out effect for the miner space ship. 

Hyper jump-\/out effect is used for exiting miner from screen to hyper jump. Starts immediately looking for a hyper jump-\/in place. Hyper jump-\/in effect is started at halftime of hyperjump-\/out timer ({\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548a4b5a3e67d50f7d5c705a6bb5b37d209b}{GameTimer::hyperJumpOutTimer}}).

A hyper jump time is calculated. Hyper jump time is the time (in seconds) when
\begin{DoxyEnumerate}
\item the hyper jump-\/out effect is shown (to hide the player)
\item the hyper jump-\/in effect is started (to bring the player back)
\end{DoxyEnumerate}

Hyper jump time is half of the {\ttfamily \hyperlink{class_game_timer_a462a7a41e3432621b2ef2d2781939548a4b5a3e67d50f7d5c705a6bb5b37d209b}{GameTimer::hyperJumpOutTimer}} time (converted to seconds) since the hyper jump-\/in effect will be started at half-\/time of the {\ttfamily hyperJumpOutTimer} and starting {\ttfamily \hyperlink{class_hyper_jump_out_effect}{HyperJumpOutEffect}} will start the timer.

A new \hyperlink{class_hyper_jump_navigator}{HyperJumpNavigator} is instantiated to calculate a new location for the miner when coming out of hyper jump. The hyper jump time is used for calculating the hyper jump-\/out time.

A location for the hyper jump-\/out effect is calculated based on current location of the miner. Hyper jump time is used to calculate the miner location when hyper jump-\/out effect occurs. If the location is out of range the location will be wrapped to the other side of screen.

Finally a new {\ttfamily \hyperlink{class_hyper_jump_out_effect}{HyperJumpOutEffect}} is instantiated (with calculated target location) and appended to the list of new effects. \hypertarget{class_game_engine_a2c1e331c7ee2b68823ab08df15331d62}{
\index{GameEngine@{GameEngine}!shipModeStatus@{shipModeStatus}}
\index{shipModeStatus@{shipModeStatus}!GameEngine@{GameEngine}}
\subsubsection[{shipModeStatus}]{\setlength{\rightskip}{0pt plus 5cm}GLfloat GameEngine::shipModeStatus (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
) const\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a2c1e331c7ee2b68823ab08df15331d62}


Returns the ship mode transformation status. 

The ship mode graphics are adjusted according to transformation status. If the transformation status is more than 0.0 and less than 1.0 the ship is transforming from ball mode to cone mode or vice versa.

\begin{DoxyReturn}{Returns}
Ship mode transformation status (value from 0.0 to 1.0) 
\end{DoxyReturn}
\hypertarget{class_game_engine_a1acf09d547f7cde080dbbe8c7c8e59df}{
\index{GameEngine@{GameEngine}!steerMissile@{steerMissile}}
\index{steerMissile@{steerMissile}!GameEngine@{GameEngine}}
\subsubsection[{steerMissile}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::steerMissile (
\begin{DoxyParamCaption}
\item[{{\bf Missile} $\ast$}]{ missile, }
\item[{bool}]{ reset = {\ttfamily false}}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a1acf09d547f7cde080dbbe8c7c8e59df}


Steers the \hyperlink{class_ufo}{Ufo} missile. 

A direction vector from missile to miner is calculated from X-\/ and Y-\/coordinates. If reset was called the missile direction is initialized with {\ttfamily \hyperlink{class_missile_abde8aa0cb2b72a8035bfb05a59ea983f}{Missile::initDirection()}} using calculated direction vector. Otherwise missile direction is adjusted according to direction vector.


\begin{DoxyParams}{Parameters}
\item[{\em missile}]The {\ttfamily \hyperlink{class_missile}{Missile}} instance being steered \item[{\em reset}]If set to ''true'' the missile direction is initialized otherwise the missile direction is adjusted. \end{DoxyParams}
\hypertarget{class_game_engine_aa18d4cabd2a97916c7e3d63b4bb2d059}{
\index{GameEngine@{GameEngine}!writeObjectPositions@{writeObjectPositions}}
\index{writeObjectPositions@{writeObjectPositions}!GameEngine@{GameEngine}}
\subsubsection[{writeObjectPositions}]{\setlength{\rightskip}{0pt plus 5cm}void GameEngine::writeObjectPositions (
\begin{DoxyParamCaption}
{}
\end{DoxyParamCaption}
)\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_aa18d4cabd2a97916c7e3d63b4bb2d059}


Stores the game object positions for the rewind mode playback. 

The current location is stored for each game object using {\ttfamily \hyperlink{class_game_object_af6d70fca7e43ef62d40633342d7de907}{GameObject::writePosition()}}. 

\subsection{Member Data Documentation}
\hypertarget{class_game_engine_a807ec8861e214d63d472703a229dcc43}{
\index{GameEngine@{GameEngine}!frameInfoQ@{frameInfoQ}}
\index{frameInfoQ@{frameInfoQ}!GameEngine@{GameEngine}}
\subsubsection[{frameInfoQ}]{\setlength{\rightskip}{0pt plus 5cm}QQueue$<${\bf FrameInfo} $\ast$$>$ {\bf GameEngine::frameInfoQ}\hspace{0.3cm}{\ttfamily  \mbox{[}private\mbox{]}}}}
\label{class_game_engine_a807ec8861e214d63d472703a229dcc43}


For storing {\ttfamily \hyperlink{class_frame_info}{FrameInfo}} data for rewind mode playback. 

The \hyperlink{class_frame_info}{FrameInfo} objects are stored into a queue data stucture, since \char`\"{}first in / first out\char`\"{} addition and removal of FrameInfos is essential. 

The documentation for this class was generated from the following files:\begin{DoxyCompactItemize}
\item 
\hyperlink{gameengine_8h}{gameengine.h}\item 
gameengine.cpp\end{DoxyCompactItemize}
